For a given prime integer p and integers α, A calculate the number of pairs of integers (n, k), such that 0 ≤ k ≤ n ≤ A and is divisible by p α . As the answer can be rather large, print the remainder of the answer moduly 109 + 7. Let us remind you that is the number of ways k objects can be chosen from the set of n objects.
输入描述:
The first line contains two integers, p and α (1 ≤ p, α ≤ 109, p is prime). The second line contains the decimal record of integer A (0 ≤ A 1000) without leading zeroes.
输出描述:
In the single line print the answer to the problem.
示例1
输入
2 2<br />7<br />3 1<br />9<br />3 3<br />9<br />2 4<br />5000<br />
输出
3<br />17<br />0<br />8576851<br />
备注:
In the first sample three binominal coefficients divisible by 4 are , and .
加载中...