Limits
1s, 512 MB

Your friend is participating in the "* Take-off Programming Contest Spring 2023*". This time, he wants to win it. So he doesn’t have any time to waste. Today, he selects some problems to practice. He will gain $P$ units of energy for each correct submission, and for each incorrect submission, he will lose $P$ units of energy. As he is a human being, his energy cannot be negative i.e. energy should always be greater or equal to $0$.

Sometimes he needs to know the current amount of energy he has. As he has no time to lose, he asked for your help to make a program to make this calculation.

The first line will be a single integer $T$ denoting the number of test cases.

In each test case, the first line will be an integer number $Q$ indicating the number of queries. The following $Q$ lines will be a query of $3$ types —

$1$ $P$ **:** $1$ means his solution is correct, and he will get $P$ units of energy.

$2$ $P$ **:** $2$ means his solution is Incorrect, and $P$ units of energy will be deducted.

$3$ **:** $3$ means the program has to print the current units of energy he has.

**$1 \le T, Q \le 10^3$**

**$1\le P \le 2147483647$**

The energy he has will always be greater than or equal to $0$ (This means if the summation of energy is Less than $0$ then the program will save the current points as $0$)

For each test case, output a line in the format **“Case X:”** (without quotes) where $X (1 \le X \le T)$ is the number of test case.

In the next lines for each query of type $3$, you have to print a line **“Y units of energy“** where $Y$ is the result of the query.

After each test case, an additional new line should be printed. Check out the samples for clarification.

Input | Output |
---|---|

2 5 1 100 3 2 50 1 100 3 3 2 200 1 100 2 50 | Case 1: 100 units of energy 150 units of energy Case 2: |

In the test case 2 there was no type 3 query so the case won’t have to print anything but it will print the new line as usual, keep that in mind. |

Input | Output |
---|---|

2 5 2 100 3 2 50 1 100 3 3 2 200 1 100 3 50 | Case 1: 0 units of energy 100 units of energy Case 2: 100 units of energy |

Be careful about the new line(‘\n’) at the end.

Toph uses cookies. By continuing you agree to our Cookie Policy.