## COI '07 #4 Umnozak

View as PDF

Points: 25 (partial)
Time limit: 0.6s
Memory limit: 32M

Problem type

The digit-product of a positive integer is the product of the number's decimal digits. For example, the digit-product of is .

The self-product of a number is the product of the number and its digit-product. For example, the self-product of is .

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

#### Input Specification

The first and only line contains two integers and .

#### Output Specification

Output should consist of a single integer, the number of positive integers whose self-product is between and .

#### Scoring

In test cases worth a total of points, and will be at most .

In test cases worth another , and will be at most .

#### Sample Input 1

20 30

#### Sample Output 1

2

#### Sample Input 2

145 192

#### Sample Output 2

4

Clarification of second example. The self-products of numbers , , and are in order , , and .

#### Sample Input 3

2224222 2224222

#### Sample Output 3

1