12716 - BigOdd++   

Description

"int" is too small to contain large odd numbers!

That's why you decided to implement your own data type, BigOdd.

You need to implement 5 basic functions:

1. Constructor. It is initalized by a string representing a non-negative integer without leading zeroes, e.g., "123".
2. Destructor.
3,4. ++x, x++, the prefix increment and postfix increment operators, respectively. Note that, since this is a BigOdd data type, whenever it increments, it will be the least odd number that is greater than the current value. For example, ++3 => 5, ++2 => 3.
5: char* to_s(): returns a duplicate of the number in char*, e.g., "123".

Input

The first line contains an integer T, representing the number of testcases that follow.

For each testcase, a non-negative integer less than pow(10, 1023) is given in the first line.

An integer Q follows, representing the number of operations regarding the testcase.

Q lines follow, each in the form of "B++" or "++B", the effect of which is described in the problem.

Output

For each operation, print the result in one line, without leading zeroes.

Sample Input  Download

Sample Output  Download

Partial Judge Code

12716.cpp

Partial Judge Header

12716.h

Tags




Discuss