Design of the sum of two functions are univariate polynomial and the product.
Input formats:
Input line 2 minutes, respectively, to each row number of the polynomial given non-zero entries, then descending exponential manner enter a nonzero polynomial coefficient and the exponent (integer not exceeding the absolute value of both 1000). Between numbers separated by a space.
Output formats:
Output in 2 rows, respectively descending exponential manner, and outputs the product polynomial and polynomial coefficients and non-zero entries in the index. Between numbers separated by spaces, but the end can not have extra spaces. Zero polynomial should be output 0 0
.
Sample input:
4 3 4 -5 2 6 1 -2 0
3 5 20 -7 4 3 1
Sample output:
15 24 -25 22 30 21 -10 20 -21 8 35 6 -33 5 14 4 -15 3 18 2 -6 1
5 20 -4 4 -5 2 9 1 -2 0