Hide

Problem C
Colossal Candy Counts

/problems/ccsc19.colossalcandycounts/file/statement/en/img-0001.jpg
Photo of candy, CC0 (public domain).

Colin wants to buy some candy. In fact, he wants to buy a colossal amount of candy, but that doesn’t necessarily mean what you think it does. Colin is obsessed with number theory and has invented a type of number called a colossal number.

An integer n0 is called colossal if there exist integers a,b0 such that ab=n, and the sum of the base-10 digits of n is equal to a. For example, 512 is colossal since 83=512 and 5+1+2=8.

Given the minimum and maximum amounts of candy Colin is willing to buy, he needs your help figuring out how many different choices he has if he wants to buy a colossal amount.

Input

The input consists of two space-separated integers, cL and cH, such that 0cLcH1012.

Output

Output a single line containing the number of colossal integers c in the interval cLccH.

Sample Input 1 Sample Output 1
15 5000
4
Sample Input 2 Sample Output 2
512 512
1
Hide

Please log in to submit a solution to this problem

Log in