How Many Solutions?
Problem
Given the values of three integers \(m, n, p\) how many integer solutions does the following equation have?
\(\frac{m}{x}+\frac{n}{y}=\frac{1}{p}\)
Input
The input file contains at most \(1001\) sets of inputs. Each set of input is given in a single line containing three integers which denotes the values of \(m, n\) and \(p\) respectively.
Input is terminated by a case where the value of \(m, n\) and \(p\) \((-1000 ≤ m, n, p ≤ 1000)\) are zero.
Output
For each set of input produce one line of output which contains the serial of output followed by an integer \(N\) which indicates how many solutions are there for the given value of \(m, n\) and \(p\).
Comment: The equation corresponding to the first sample input is: \(\frac{1}{x}+\frac{2}{y}=\frac{1}{4}\) and the 11 solutions corresponding to this equation are:
-28 7
-12 6
-4 4
2 -8
3 -24
5 40
6 24
8 16
12 12
20 10
36 9
Sample
Input
1 2 4
2 3 4
0 0 0
Output
Case 1: 11
Case 2: 23
Comments