John has recently arrived in Bucharest for the South Eastern European Regional Contest. John is famous for his theory of lucky numbers, which makes all contestants and spectators very happy.
According to this theory, and are lucky digits, and all other digits are not lucky. A lucky number is a number that contains only lucky digits in its decimal notation. A very lucky number is a number that can be expressed as a product of several lucky numbers. A lucky number itself is also considered very lucky. For example, the numbers , , and are very lucky.
Your task is to calculate the number of very lucky numbers that are not less than and not greater than . Of course, the numbers and are given by John.
The first line of input contains a single integer — the number of test cases. Each of the next lines contains two integers separated by a single space — and .
Constraints: 1 \le T \le 7777, 1 \le A \le B \le 10^{12}.
Output must contain lines — the answers for the test cases.
Example 1