#Q233. 「一本通 6.6 练习 2」方程的解
「一本通 6.6 练习 2」方程的解
Description
Jiajia encountered a challenging problem and needs your help to solve it. Consider the indeterminate equation , where and , is a positive integer, (i.e., the remainder when is divided by 1000), and are given. We are to determine the number of positive integer solutions to this equation.
For example, when , the solutions to the equation are:
$$\begin{cases} a_1=1\\ a_2=1\\ a_3=2 \end{cases} \ \ \ \ \begin{cases} a_1=1\\ a_2=2\\ a_3=1 \end{cases} \ \ \ \ \begin{cases} a_1=2\\ a_2=1\\ a_3=1 \end{cases} $$Input Format
There is one and only one line containing two positive integers separated by a space, representing and respectively.
Output Format
Output one and only one line, the number of positive integer solutions to the equation.
Sample 1
3 2
3
Data Range and Hint
For of the data, the answer does not exceed ;
For all data, .