시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB1271069088.235%

문제

Your favorite uncle has passed away, leaving you a large estate. Bank account numbers, locations of safe deposit boxes, and GPS coordinates to buried treasures are all locked in an electronic safe in your uncle’s office behind a picture of dogs playing poker. One day he showed you the safe with its 9 digit keypad (digits 1 through 9). He told you he wasn’t worried about anyone breaking into his safe because it’s equipped with a self-destruct mechanism that will destroy the contents if anyone attempts a forced entry.

The combination is a sequence of six decimal digits. If an incorrect combination is entered the safe enforces a thirty-second delay before accepting another combination. So a brute-force effort to try all six-digit combinations could take months.

Your uncle had planned to give you, his sole heir, the combination one day, but due to an unfortunate hanggliding accident in Kansas, you now must rely on your deductive and programming skills to access the key to your inheritance.

Here’s what you know:

  • The combination c is a sequence of six non-zero decimal digits.
  • Your mother recalls that she heard your uncle mention that all the digits are different.
  • You remember that your uncle once said that the six digit number was divisible by each of its individual digits.

An example satisfying these conditions is 123864: all six digits differ, and you can check that 123864 is divisible by each of 1, 2, 3, 8, 6 and 4.

Even with the helpful data, it could take a while to get to open the safe, so the task is likely to be split into several sessions with separate ranges being tested. How many combinations are there to try in the range given?

입력

The input is a line with two space-separated integers L and H, where 123 456 ≤ L < H ≤ 987 654

출력

Print one integer, the total number of possible combinations to the safe, where each combination c must satisfy the three constraints above, and lie in the range L ≤ c ≤ H.

예제 입력 1

123864 123865

예제 출력 1

1

예제 입력 2

198765 198769

예제 출력 2

0

예제 입력 3

200000 300000

예제 출력 3

31