#OLD386. Univariate Polynomial

Univariate Polynomial

Description

Kiudou is a powerful and man, who has lots of fans in syuct acm-lab. The lab attaches great importance to the quality of mathematics teaching, so at least arranges a math training every day. On this day, the teacher gave a question in the math class. He was very tired because he secretly played the game and stayed night, he fell asleep accidentally. After returning home, Kiudou started do a math homework and found that one of the questions seemed to be the one that the teacher said in class. Now he regrets that he did not listen well in class, which led him to have a difficulty in this problem. The topic is very simple. There are two univariate polynomials, working out the product and sum of these two univariate polynomials. Can you help Kiudou solve this problem?

Format

Input

The Input contains two lines.

At first each line input the number NN, indicating non-zero terms of each polynomial.Then, a polynomial non-zero coefficients and exponents (absolute values are not more than 1000) are input by exponential descent. Numbers are separated by spaces.(0N200\leq N\leq 20)

Output

The output contains two lines.

The first line outputs the coefficients and exponents of the product polynomial non-zero terms in exponential descent mode, and the second line outputs the coefficients and exponents of the sum polynomial non-zero terms in exponential descent mode. Numbers are separated by spaces.

There should be no additional space at the end.

Samples

4 3 4 -5 2  6 1 -2 0
3 5 20 -7 4 3 1

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

0
1 999 1000

0 0
999 1000

Hint

The zero polynomial should output 0 0.