Time limit
2s
Memory limit
128 MB
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.
The first line contains two integers A and B. (1 <= A <= B < 1018)
Output the number of positive integers whose self-product is between A and B, inclusive.
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.