Problem3933--The Almost Lucky Numbers(Harder)

3933: The Almost Lucky Numbers(Harder)

[Creator : ]
Time Limit : 3.000 sec  Memory Limit : 128 MB

Description

John and Brus believe that the digits 4 and 7 are lucky and all others are not. According to them, an almost lucky number is a number that contains at most one non-lucky digit in its decimal representation. Return the total number of almost lucky numbers between a and b, inclusive.

Input

Each line contains two integers a,b<=10^16

Output

For each line of input,output the total number of almost lucky numbers between a and b, inclusive.

Sample Input Copy

4 7
8 19

Sample Output Copy

4
4

Source/Category