Croatian Olympiad in Informatics 2008

Task UMNOZAK

The digit-product of a positive integer is the product of the number's decimal digits. For example, the digit-product of 2612 is 2 · 6 · 1 · 2 = 24.

The self-product of a number is the product of the number and its digit-product. For example, the self-product of 2612 is 2612 · 24 = 62688.

Write a program that, given two positive integers A and B, calculates the number of positive integers whose self-product is between A and B, inclusive.

Input

The first and only line contains two integers A and B (1 ≤ A ≤ B < 1018).

Output

Output should consist of a single integer, the number of positive integers whose twist is between A and B.

Scoring

In test cases worth a total of 25 points, A and B will be at most 108.

In test cases worth another 15, A and B will be at most 1012.

Examples

Input

20 30

Output

2

Input

145 192

Output

4

Input

2224222 2224222

Output

1

Clarification of example 2: The self-products of numbers 19, 24, 32 and 41 are in order 171, 192, 192 and 164.

All Submissions
Best Solutions


Point Value: 30 (partial)
Time Limit: 1.00s
Memory Limit: 64M
Added: Aug 12, 2013

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

It's quiet in here...