Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js

G. D-Function
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Let D(n) represent the sum of digits of n. For how many integers n where 10ln<10r satisfy D(kn)=kD(n)? Output the answer modulo 109+7.

Input

The first line contains an integer t (1t104) – the number of test cases.

Each test case contains three integers l, r, and k (0l<r109, 1k109).

Output

For each test case, output an integer, the answer, modulo 109+7.

Example
Input
6
0 1 4
0 2 7
1 2 1
1 2 3
582 74663 3
0 3 1
Output
2
3
90
12
974995667
999
Note

For the first test case, the only values of n that satisfy the condition are 1 and 2.

For the second test case, the only values of n that satisfy the condition are 1, 10, and 11.

For the third test case, all values of n between 10 inclusive and 100 exclusive satisfy the condition.