10372 - 補考problem1   

Description

The input contains two polynomials f(x) and g(x).

f(x) = amxm + a(m-1)x(m-1) + + a1x1 + a0x0
g(x) = b
nxn + b(n-1)x(n-1) + + b1x1 + b0x0

where m,nN, 0≤m,n≤10.

Compute h(x) = f(x)g(x).

Note that all the coefficients are integers.

Input

m

am a(m-1)  … a1 a0
n
b
n b(n-1)  … b1 b0

Note that the coefficients are separated by a blank.

Output

The coefficients of h(x) in descending power order.

Use "%d " to print each coefficient and there is a newline at the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss