Hide

Problem B
Elliptic Curve Points

Determine basic properties of elliptic curves.

Input

Each line of the input consists of a space-separated list of: one prime integer $p$, and two integer coefficients $a$ and $b$ of an elliptic curve $y^2=x^3+ax+b$. All integers are positive and given in decimal with at most 6 digits.

Output

For each input line, output a line containing (separated by space): 1/0 depending if the curve is singular/smooth and the number of affine points on the curve (i.e., the point at infinity is not counted).

Sample Input 1 Sample Output 1
461 2 46
479 2 46
509 2 45
1 462
0 507
0 473

Please log in to submit a solution to this problem

Log in