#P1947. Digitcounting

Digitcounting

Given a interval [a,b] , calculate the occurrence number of digit k.

Input

First line contains a integer T which is the number of test cases.(T<=1010)
And there are T lines later,which contains three intergers a,b,k.(1<=a<=b<10^9 , 0<=k<=9)

Output

For each test case, you should output the answers and every line only contains one integer.

Sample Input

2
1 10 1
1 11 1

Sample Output

2
4

HINT

Source