smoothie-web Problems Contests Ranking About

# J3 - Soup and Polynomials

Recently in math class, Soup has learned how to multiply polynomials. His teacher has recently assigned him $N$ problems for homework. But as he wants to play League with his Egirls, he has tasked you with writting him a program to solve all the problems.

## Constraints

$0 \leq N , M \leq 10^4$

The coefficients of the polynomial will be in between $0$ and $1000$ inclusive.

## Input Specifications

The first line will contain the integers $N$ and $M$, denoting the number of coefficients in the first polynomial and the second polynomial.

The next line of input will contain $N$ integers the coefficient of the first polynomial.

The final line of will contain $M$ integers, the coefficients of the second polynomial.

## Output Specifications

Output $N+M-1$ integers, representing the coefficients of the resulting polynomial.

## Sample Input 1

3 2
9 7 4
11 3


## Sample Output 1

99 104 65 12


## Sample Explanation 1

The two polynomials are $9 + 7x + 4x^2$ and $11 + 3x$. The product will be $99 + 104x + 65x^2 + 12x^3$. Thus, the coefficient of the terms will be $99, 104, 65$ and $12$.

## Sample Input 2

7 12
9 2 7 4 6 2 14
8 9 1 3 10 5 6 4 7 0 17 11


## Sample Output 2

72 97 83 124 187 160 282 269 213 158 404 267 275 215 244 100 260 154