Equation

아직 제출이 없습니다시간 제한1초메모리 제한256 MB

문제

For a positive integer nn, let f(n)f(n) be the sum of squares of its digits in the decimal notation. Given are three integers k,a,bk, a, b. Your task is to determine the number of such natural numbers nn, that anba \le n \le b and nn is the solution of the equation \[ k\cdot f(n) = n. \]

입력

The first and only line of the input contains three integers of the task statement: k,a,bk, a, b, (1k,a,b10181 \le k, a, b \le 10^{18}, aba \le b).

출력

Your program should output a single integer: the number of integral solutions of the given equation contained in the range \[a,b]\[a,b].

힌트

In the example, the only positive integers nn from the range \[5000,10000]\[5000,10000] satisfying the equation for k=51k=51 are 72937293, 78547854 and 79057905.