Problem Statement
We have a polynomial of degree N, A(x)=ANxN+AN−1xN−1+cdots+A1x+A0,
and another of degree M, B(x)=BMxM+BM−1xM−1+cdots+B1x+B0.
Here, each coefficient of A(x) and B(x) is an integer whose absolute value is at most 100, and the leading coefficients are not 0.
Also, let the product of them be $C(x)=A(x)B(x)=C_{N+M}x^{N+M}+C_{N+M-1}x^{N+M-1}+\\cdots +C_1x+C_0$.
Given A0,A1,ldots,AN and C0,C1,ldots,CN+M, find B0,B1,ldots,BM.
Here, the given inputs guarantee that there is a unique sequence B0,B1,ldots,BM that satisfies the given conditions.
Constraints
- 1leqN<100
- 1leqM<100
- ∣Ai∣leq100
- ∣Ci∣leq106
- ANneq0
- CN+Mneq0
- There is a unique sequence B0,B1,ldots,BM that satisfies the conditions given in the statement.
Input is given from Standard Input in the following format:
N M
A0 A1 ldots AN−1 AN
C0 C1 ldots CN+M−1 CN+M
Output
Print the M+1 integers B0,B1,ldots,BM in one line, with spaces in between.
1 2
2 1
12 14 8 2
Sample Output 1
6 4 2
For A(x)=x+2 and B(x)=2x2+4x+6, we have C(x)=A(x)B(x)=(x+2)(2x2+4x+6)=2x3+8x2+14x+12, so B(x)=2x2+4x+6 satisfies the given conditions. Thus, B0=6, B1=4, B2=2 should be printed in this order, with spaces in between.
1 1
100 1
10000 0 -1
Sample Output 2
100 -1
We have A(x)=x+100, C(x)=−x2+10000, for which B(x)=−x+100 satisfies the given conditions. Thus, 100, \-1 should be printed in this order, with spaces in between.