For the given integers a, b, c, n, p, compute the value of the sum:
Print the result as two numbers and such that
Five integers a, b, c, n, p are given. It is known that:
p < 10^9 is a prime number,
0 \le a, b < p,
1 \le c < p,
0 \le n \le 10^9
Print two integers and — the coefficients of and \sqrt{c} respectively, modulo .
In the first example:
In the second example:
Example 1
Example 2
You should work in the extended field:
Operation rules:
Addition
Multiplication
All operations are performed modulo .