GEEKOUNT - EVEN COUNT

Let f(x) be the product of digits of a number.

Given L and R, find the number of values of 'i' such that L ≤ i ≤ R and f(i) is even.

Input

The first line consists of an integer t, the number of test cases. For each test case, you are given the two integers L and R.

Output

For each test case, print the number of values of 'i' such that L ≤ i ≤ R and f(i) is even.

Constraints

1 ≤ t ≤ 100

1 ≤ L ≤ R ≤ 1000000000

Sample

Input:
2
2 12
4 23

Output:
6
12

Added by:cegprakash
Date:2013-01-15
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: BF GOSU
Resource:problem setter: rkarthikeyan

hide comments
2013-01-24 21:33:50 cegprakash
The submissions will be opened after 2 days. Wait for it.
2013-01-24 21:22:06 Md. Sumsuddin Shojib
how can i submit this problem now
2013-01-24 19:09:42 Ahmed Jolani


Last edit: 2013-01-24 19:19:50
2013-01-24 19:08:43 cegprakash
shadow: u can check the output with a brute force solution
2013-01-24 18:48:39 ਘੋੜਾ
can anyone tell the o/p of this case



2
252 12514254
215463 95141426
2013-01-24 18:39:15 Ahmed Jolani
It's a number theory problem.
2013-01-24 18:23:12 code warrior
getting TLE...
suggesstions r welcomed


Last edit: 2013-01-24 18:23:45
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.