Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by each of its nonzero digits. We will not argue with this and just count the quantity of beautiful numbers in given ranges.
The first line of the input contains the number of cases *t* (1 ≤ *t* ≤ 10). Each of the next *t* lines contains two natural numbers *l*<sub class="lower-index">*i*</sub> and *r*<sub class="lower-index">*i*</sub> (1 ≤ *l*<sub class="lower-index">*i*</sub> ≤ *r*<sub class="lower-index">*i*</sub> ≤ 9 ·10<sup class="upper-index">18</sup>).

Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cin (also you may use %I64d).
n = int(input())
ans = []
for i in range(n):
    l, r = [int(elt) for elt in input().split(" ")]
    s = 0
    for j in range(l,r+1):
        nbr = [int(elt) for elt in str(j)]
        k = 0
        lon = len(nbr)
        while k < lon and j % nbr[k] == 0:
            k += 1
        if k == lon:
            s += 1
    ans.append(s)
for elt in ans:
    print(elt)