Count the Magical Number

3

1 votes
Problem

A number is called magical number if it consist of number no other than (3, 7). You need to find the total magic number X between L and U.

The first few magical numbers are (3, 7, 33, 37, 73……)

 

Input

The first line of input contains the only integer denoting the number of testcases.

Second line contains contains two integers L and U.

Output

Print the total magic number X between L and U.

Constraints

1 ≤  T ≤ 105

0 ≤ L, U ≤ 1016

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

For 4th Test Case their are 6 magic number between 0 and 100 
3,7,33,37,73,77

Editor Image

?