According to some theory, 4 and 7 are lucky digits, and all the other digits are not lucky. A lucky number is a number that contains only lucky digits in decimal notation. A very lucky number is a number that can be expressed as a product of several lucky numbers. A lucky number by itself is considered to be very lucky. For example, numbers 47, 49, 112 are very lucky.
Your task is to calculate the number of very lucky numbers that are not less than A and not greater than B.
Input
Input starts with an integer T (≤ 8000), denoting the number of test cases.
Each case starts with a line containing two integers A and B (1 ≤ A ≤ B ≤ 1012).
Output
For each case, print the case number and the result.
Sample
Sample Input | Sample Output |
---|---|
4 1 2 88 99 112 112 1 100 | Case 1: 0 Case 2: 0 Case 3: 1 Case 4: 10 |
Notes
Very lucky numbers for the last sample input are {4, 7, 16, 28, 44, 47, 49, 64, 74 , 77}.