Santa's Lucky Numbers
Limits: 2 sec., 256 MiB
As you probably know the lucky number is a positive integer number that contains only 4 and 7 in its decimal notation. For example, numbers 47, 4 and 74774777 are lucky and 54, 1 and 10 are not.
Santa Claus would like to have more lucky numbers. He has his own set of the lucky numbers. Santa’s lucky number is a positive integer number that is divisible by at least on lucky number. For example, 8, 42 and 94 are Santa’s lucky numbers.
You have to find the number of Santa’s lucky numbers that are not less than \(A\) and are not greater than \(B\).
Input
Two integer numbers \(A\) and \(B\) separated by a single space.
Output
Print a single integer — the number of Santa’s lucky numbers between \(A\) and \(B\), inclusive.
Constraints
\(1 \le A \le B \le 1000000000 (10^9)\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 1 100 | 39 |
Notes
The Did Moroz’s lucky numbers on the interval \([1, 100]\) are: 4, 7, 8, 12, 14, 16, 20, 21, 24, 28, 32, 35, 36, 40, 42, 44, 47, 48, 49, 52, 56, 60, 63, 64, 68, 70, 72, 74, 76, 77, 80, 84, 88, 91, 92, 94, 96, 98, 100.
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|