Today Oz is busy with cool numbers. Cool numbers are positive integers whose decimal representation contains only the cool digits 2 and 5. For example, numbers 25, 522, 2 are cool and 7, 15, 265 are not.
Let f(k) be the smallest cool number greater than or equals k. Oz is interested what is the value of the following expression for a given pair (l,r) :
Input :
The first line of input contains an integer T - number of test cases. Each test case consist of two integers l and r.
Output :
For each test case output required answer.
Constraint :
1 ≤ T ≤ 50
1 ≤ l ≤ r ≤ 109
In the first sample:
f(3)+f(4)+f(5)+f(6)+f(7)=5+5+5+22+22=59
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor