#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

## Problem Description

Oh no! Shorty is having his Basic Calculus Exam today, and he has not studied a single bit. Also, because of his poor results this year, if he fails this exam, he will be expelled!

However, being lazy, he still does not want to study. Instead, he wants you to write a program to answer the exam questions for him.

Each of his exam questions are as follows: Shorty is given a function *f (x)*, and he must find the derivative of that function *f '(x)*, in descending order of the exponents, fully expanded and simplified. There will always be a space between a sign (+/-) and *x* or any digit.

However, there is one problem. His teacher, Mr Bob, is extremely forgetful and often displays the function incorrectly. Also, he is too lazy to re-write the function. Thus, at times he may ask the class to add or subtract a term from *f (x)* and re-differentiate it.

At any point in time, Shorty may perform 2 actions:

1: Differentiate the function and output the derivative *f '(x)*.

2: Add a term to *f (x)*.

It is guaranteed that the function given is valid, fully expanded and simplified, and has at most one term for any power of *x*. The coefficient and exponent of each term will fit into a 32-bit signed integer.

## Input

The first line of the input contains the polynomial function *f (x)*.

Each subsequent line will begin with an integer *k* representing the action Shorty must perform. When *k* = 2, it will be followed by the term to be added (refer to sample input).

The input will be terminated by a null action *k* = 0.

## Output

Output a line containing the function *f '(x)*, for *each time* Shorty performs action 1.

## Subtasks

Subtask 1 (5%): *deg(f (x)) < 2*. Mr Bob will never add new terms :)

Subtask 2 (13%): The original function will only contain 1 term. There will be at most *1000* actions performed.

Subtask 3 (82%): No restrictions

Subtask 4 (0%): Sample testcase

## Sample Input

x^2 - 2x + 1 1 2 3x 1 0

## Sample Output

2x - 2 2x + 1

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 5 | 5 | 4s | 8MB | Minimum |

2 | 13 | 8 | 4s | 8MB | Minimum |

3 | 82 | 25 | 4s | 8MB | Minimum |

4 | 0 | 1 | 4s | 8MB | Minimum |

### Judge Compile Command

g++-7 ans.cpp -o mathexam -Wall -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512