Mancunian is a fan of the special properties of numbers and adores all things numerical.
His latest fascination are the so-called "zeroless" Pandigital Numbers. But he has imposed an additional restriction that each digit (from 1-9) should occur atmost once in the number. Such zeroless pandigital numbers are called almighty pandigital numbers. To sum up, an almighty pandigital number is an integer (let its number of digits be d) such that it contains the digits from 1 to d exactly once. For example, 102 is a pandigital number but not zeroless. 231445 is a zeroless pandigital number but not almighty. 35124 is an almighty pandigital number.
Given Q queries, each of the type L R, he asks you to find the number of almighty pandigital numbers in the range from L to R (inclusive).
Input:
The first line contains Q denoting the number of queries. Each of the next Q lines is of the form L R denoting a specific query.
Output:
For each query, output the answer to the given query in a new line.
Constraints:
1 <= Q <= 105
1 <= L, R <= 106
Case 1: There are 3 almighty pandigital numbers, 1, 12 and 21.
Case 2: There are no almighty pandigital numbers in the specified range.
Case 3: The numbers 231, 312, 321 and 1234 are almighty pandigital.