CF300C.Beautiful Numbers

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vitaly is a very weird man. He's got two favorite digits aa and bb . Vitaly calls a positive integer good, if the decimal representation of this integer only contains digits aa and bb . Vitaly calls a good number excellent, if the sum of its digits is a good number.

For example, let's say that Vitaly's favourite digits are 11 and 33 , then number 1212 isn't good and numbers 1313 or 311311 are. Also, number 111111 is excellent and number 1111 isn't.

Now Vitaly is wondering, how many excellent numbers of length exactly nn are there. As this number can be rather large, he asks you to count the remainder after dividing it by 10000000071000000007 (109+7)(10^{9}+7) .

A number's length is the number of digits in its decimal representation without leading zeroes.

输入格式

The first line contains three integers: aa , bb , nn (1<=a<b<=9,1<=n<=106)(1<=a<b<=9,1<=n<=10^{6}) .

输出格式

Print a single integer — the answer to the problem modulo 10000000071000000007 (109+7)(10^{9}+7) .

输入输出样例

  • 输入#1

    1 3 3
    

    输出#1

    1
    
  • 输入#2

    2 3 10
    

    输出#2

    165
    
首页