For an integer , let denote the residue classes modulo . In this problem, every residue is represented by one of .
A nonzero polynomial of degree ,
is called a palindromic polynomial if for every . The zero polynomial is not considered palindromic.
You are given a nonzero polynomial over ,
Construct an integer with and palindromic polynomials such that
All coefficient additions are performed modulo .
The input is given from Standard Input in the following format:
For each test case, first print the number of palindromic polynomials used.
Then print lines. For the -th palindromic polynomial
All three printed polynomials are palindromic. Adding their coefficients modulo gives , which is exactly the input polynomial.
Each case is given in the following format:
Here is the modulus for the coefficients and is the degree of the input polynomial. The coefficients are given from the constant term to the leading term.
print one line in the following format:
The output must satisfy all of the following conditions.
If there are multiple valid outputs, print any of them. Do not print any separator between test cases.
| 2 | 80 | No additional constraints. |