The Great Ninja War is going on. Naruto got some information from his spy that there are some special troops in the enemy's army. Troops are numbered starting from 1.
Special Troops are described as follows :-
Let's say the troop number consists of N digits given as {D1,D2,D3,.....,DN}, for which the special sum S will be ∑Ni=1DiDi ∀ Di≠0.
If all the digits Di ∀ i∈[1,N] and Di≠0 of that number completely divide the special sum S, then the troop is special.
For example, consider the troop number 2024, the special sum S will be 22+22+44=264. As all the non-zero digits 2, 2 and 4 completely divide 264, hence the troop is special.
Naruto asked you to find the number of special troops numbered between L and R (both inclusive).
INPUT FORMAT
The first line of input contains a single integer Q denoting the number of testcases.
Each of the next Q lines consist of two space separated integers L and R.
OUTPUT FORMAT
The output should consist of Q lines each consisting of a single integer denoting the answer to the question.
CONSTRAINTS
The number of special numbers in the range 10 to 20 is 3 and that in the range 5 to 50 is 18.