dsd-numbers

Bob likes DSD Numbers.DSD Number is a number which is divisible by its Digit Sum in Decimal Representation.

digitSum(n) : Sum of digits of n (in Decimal Representation)

eg:  n = 1234  then digitSum(n) = 1 + 2 + 3 + 4 = 10

DSD Number is number n such that  n % digitSum(n) equal to 0

Bob asked Alice to tell the number of DSD Numbers in range [L,R] inclusive. Alice does not know the answer,So she asked her Coder friend i.e you for the help. Help Her !!

Constraints:

1 ≤ test cases ≤ 50

1 ≤ L ≤ R ≤ 10^9

SAMPLE INPUT
4
2 5
1 10
20 45
1 100

SAMPLE OUTPUT
4
10
9
33

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions: