cho.sh
Notes
Loading...

Boyle's Law

Time limit

2s

Memory limit

128 MB

Problem

The digit product of a positive integer N is the product of all digits in its decimal representation. For instance, the digit product of 2612 is 2 * 6 * 1 * 2 = 24.

The self-product of N is N multiplied by its digit product. Thus the self-product of 2612 is 2612 * 24 = 62688.

Given two integers A and B, count the positive integers N whose self-product is at least A and at most B.

Input

The first line contains two integers A and B. (1 <= A <= B < 101810^{18}1018)

Output

Output the number of positive integers whose self-product is between A and B, inclusive.

Hint

The self-products of 19, 24, 32, and 41 are 171, 192, 192, and 164, respectively. Therefore, in the range [145, 192], these four numbers satisfy the condition.