PROGRAMMING:Polynomial operation
####Title Description
If we know the integral coefficient polynomials A and B of X, please calculate their sum, difference or product.
####Input format
```
There are several groups of data (every three lines is one group of data, no more than 10 groups)
The first row of each group of data (representing polynomial a): the first integer represents the number of polynomial terms (no more than 11), and the next n pairs of integers represent the coefficients and powers of each term of the polynomial (each power value does not exceed 10 and does not repeat).
The second row of each group of data (representing polynomial b): the first integer represents the number of polynomial terms (no more than 11), and the next n pairs of integers represent the coefficients and powers of each term of the polynomial (each power value does not exceed 10 and does not repeat).
The third row of each group of data is an integer, 1 for addition, 2 for subtraction, and 3 for multiplication.
```
####Output format
```
Output several rows, each row is the result polynomial of a group of data.
The output format is described as follows (please compare and analyze the input and output examples carefully)
(1) Results the polynomials were arranged in descending order of x power, and the items with coefficient 0 were not output.
(2) The basic output format of each item is "DX ^ P", where D is the coefficient and P is the index.
(3) The first item does not output + before the positive coefficient, and the other cases need to output sign (positive or negative sign) before the coefficient.
(4) If the coefficient of a term is 1, the value of the coefficient is not output, except for the constant term.
(5) If the exponent is 1, the ^ 1 after X is not output.
(6) The constant term only outputs the coefficient itself, not x ^ 0.
(7) Each result should be the simplest polynomial, that is, no similar term can appear.
```
####Input sample
```in
3 5 2 6 1 7 0
2 -10 2 15 0
one
2 1 2 5 1
2 2 3 3 0
three
2 1 3 -1 0
2 -1 2 5 1
one
2 1 3 -1 0
2 -1 2 5 1
two
2 1 3 -1 0
2 -1 2 5 1
three
```
####Output sample
```out
-5X^2+6X+22
2X^5+10X^4+3X^2+15X
X^3-X^2+5X-1
X^3+X^2-5X-1
-X^5+5X^4+X^2-5X
```
####Explanation
Please carefully analyze the format of input data and output data.
1. Input the first set of data of the sample, which is the sum of the polynomial $$5x ^ 2 + 6x + 7 $$and the polynomial $$- 10x ^ 2 + 15 $$;
1. Input the second set of data of the sample, which is to calculate the product of the polynomial $$x ^ 2 + 5x $$and the polynomial $$2x ^ 3 + 3 $.
1. The first group of data of the output sample is the output polynomial $$- 5x ^ 2 + 6x + 22 $$;
1. The second group of data of the output sample is the output polynomial $$- 2x ^ 5-10x ^ 4 + 3x ^ 2 + 15x $$;
1. The third group of data of the output sample is the output polynomial $$x ^ 3-x ^ 2 + 5x-1 $.
answer:If there is no answer, please comment
If we know the integral coefficient polynomials A and B of X, please calculate their sum, difference or product.
####Input format
```
There are several groups of data (every three lines is one group of data, no more than 10 groups)
The first row of each group of data (representing polynomial a): the first integer represents the number of polynomial terms (no more than 11), and the next n pairs of integers represent the coefficients and powers of each term of the polynomial (each power value does not exceed 10 and does not repeat).
The second row of each group of data (representing polynomial b): the first integer represents the number of polynomial terms (no more than 11), and the next n pairs of integers represent the coefficients and powers of each term of the polynomial (each power value does not exceed 10 and does not repeat).
The third row of each group of data is an integer, 1 for addition, 2 for subtraction, and 3 for multiplication.
```
####Output format
```
Output several rows, each row is the result polynomial of a group of data.
The output format is described as follows (please compare and analyze the input and output examples carefully)
(1) Results the polynomials were arranged in descending order of x power, and the items with coefficient 0 were not output.
(2) The basic output format of each item is "DX ^ P", where D is the coefficient and P is the index.
(3) The first item does not output + before the positive coefficient, and the other cases need to output sign (positive or negative sign) before the coefficient.
(4) If the coefficient of a term is 1, the value of the coefficient is not output, except for the constant term.
(5) If the exponent is 1, the ^ 1 after X is not output.
(6) The constant term only outputs the coefficient itself, not x ^ 0.
(7) Each result should be the simplest polynomial, that is, no similar term can appear.
```
####Input sample
```in
3 5 2 6 1 7 0
2 -10 2 15 0
one
2 1 2 5 1
2 2 3 3 0
three
2 1 3 -1 0
2 -1 2 5 1
one
2 1 3 -1 0
2 -1 2 5 1
two
2 1 3 -1 0
2 -1 2 5 1
three
```
####Output sample
```out
-5X^2+6X+22
2X^5+10X^4+3X^2+15X
X^3-X^2+5X-1
X^3+X^2-5X-1
-X^5+5X^4+X^2-5X
```
####Explanation
Please carefully analyze the format of input data and output data.
1. Input the first set of data of the sample, which is the sum of the polynomial $$5x ^ 2 + 6x + 7 $$and the polynomial $$- 10x ^ 2 + 15 $$;
1. Input the second set of data of the sample, which is to calculate the product of the polynomial $$x ^ 2 + 5x $$and the polynomial $$2x ^ 3 + 3 $.
1. The first group of data of the output sample is the output polynomial $$- 5x ^ 2 + 6x + 22 $$;
1. The second group of data of the output sample is the output polynomial $$- 2x ^ 5-10x ^ 4 + 3x ^ 2 + 15x $$;
1. The third group of data of the output sample is the output polynomial $$x ^ 3-x ^ 2 + 5x-1 $.
answer:If there is no answer, please comment