eolymp
bolt
Try our new interface for solving problems
Problems

Multiplying polynomials

Multiplying polynomials

We introduce a symbolic form of two polynomials in \textbf{x} with integer coefficients. Output of the product in descending order of degrees - also in a symbolic form. The degree of initial polynomials are not over \textbf{10}, the coefficients of initial polynomials modulo no more than \textbf{10^4}. \InputFile The two lines are polynomials. \OutputFile In a single line shows a polynomial.
Time limit 1 second
Memory limit 64 MiB
Input example #1
0
0
Output example #1
0
Input example #2
x+1
x-1
Output example #2
x^2-1