#abc137f. [abc137_f]Polynomial Construction
[abc137_f]Polynomial Construction
Problem Statement
Given are a prime number and a sequence of integers consisting of zeros and ones.
Find a polynomial of degree at most , $f(x) = b_{p-1} x^{p-1} + b_{p-2} x^{p-2} + \\ldots + b_0$, satisfying the following conditions:
- For each , is an integer such that .
- For each , .
Constraints
- is a prime number.
Input
Input is given from Standard Input in the following format:
Output
Print of a polynomial satisfying the conditions, in this order, with spaces in between.
It can be proved that a solution always exists. If multiple solutions exist, any of them will be accepted.
Sample Input 1
2
1 0
Sample Output 1
1 1
satisfies the conditions, as follows:
Sample Input 2
3
0 0 0
Sample Output 2
0 0 0
is also valid.
Sample Input 3
5
0 1 0 1 0
Sample Output 3
0 2 0 1 3