#P6400. Count Numbers with Self-Product in Range

    ID: 19615 Type: Default 1000ms 256MiB

Count Numbers with Self-Product in Range

Count Numbers with Self-Product in Range

Given two integers (A) and (B), define the digit product of a positive integer as the product of its digits. For example, the digit product of (2612) is (2\times6\times1\times2=24). The self-product of a positive integer is defined as the number multiplied by its digit product. For example, the self-product of (2612) is (2612\times24=62688).

Your task is to count how many positive integers (n) satisfy (A \leq n\times d(n) \leq B), where (d(n)) is the digit product of (n).

inputFormat

The input consists of two space-separated integers (A) and (B).

outputFormat

Output a single integer representing the number of positive integers (n) such that the self-product (n\times d(n)) is in the interval ([A,B]) (inclusive).

sample

1 30
11