Welcome to the world of happy numbers. In this world, only digits 4 and 7 are happy while the rest are unhappy, so happy numbers are those composed of 4s and 7s, e.g. 123456 and 4749 are unhappy but 774 and 4747 are happy numbers.
Given two numbers A and B, print the amount of happy numbers in the range [A, B] such that 0 ≤ A < B ≤ 109.
Input
The input starts with the number of test cases T ≤ 1000. For each test case, there are two integers A and B that corresponds to range where we have to look for happy numbers.
Output
For each test case, output the total number of happy numbers in the range [A,B].
In the first example, in [1,10] only 4 and 7 are happy so the answer is 2.
In the second example, in [44,450], the happy numbers are 44, 47, 74, 77, 444 and 447 so the answer is 6.
Input
2 1 10 44 450
Output
2 6