Hide

Problem B
Broken Keypad

Astronauts are trained for all kinds of contingencies before launch day, and have a unique identifier number for every problem they could possibly come up with. As soon as they identify the problem, they plug the identifier into a keypad to send the information to their crew-mates and to mission control back on Earth.

A few days after the big launch, however, the “$7$” key got stuck! The protocol for this scenario is to re-assign any identifier containing a “$7$” to a different number. The astronauts are wondering how much work this will take, so as the chief coder for the mission you should write a program which counts how many identifiers in a given range of integers contain the digit “$7$” and must be re-assigned.

Input

Input consists of two space-separate integers $1 \leq a \leq b \leq 77^7 < 2 \cdot 10^{13}$.

Output

Output the number of integers in the inclusive range $[a, b]$ which contain the digit $7$.

Sample Input 1 Sample Output 1
1 10
1
Sample Input 2 Sample Output 2
8 16
0
Sample Input 3 Sample Output 3
700 777
78

Please log in to submit a solution to this problem

Log in