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 units of energy for each correct submission, and for each incorrect submission, he will lose units of energy. As he is a human being, his energy cannot be negative i.e. energy should always be greater or equal to .
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 denoting the number of test cases.
In each test case, the first line will be an integer number indicating the number of queries. The following lines will be a query of types —
: means his solution is correct, and he will get units of energy.
: means his solution is Incorrect, and units of energy will be deducted.
: means the program has to print the current units of energy he has.
The energy he has will always be greater than or equal to (This means if the summation of energy is Less than then the program will save the current points as )
For each test case, output a line in the format “Case X:” (without quotes) where is the number of test case.
In the next lines for each query of type , you have to print a line “Y units of energy“ where 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.