Programming contests

Magas szintű programozási nyelvek 1, egyéni verseny, 2014. április 13.

April 13, 2014 10:15 AM – April 13, 2014 3:15 PM

Save Setu

Rahaduzzaman Setu, Roll 12 of 13th batch, CSE, University of Dhaka is tremendously ill. He has been suffering from multidrug-resistant tuberculosis for a long time. Now, his left lung is damaged and beyond repair. No medicine is working on his body to ease his pain. It is urgent to operate on his left lung so that the disease doesn't spread to his right lung. It can either be removed through surgery or transplanted. He comes from a modest family, and it is difficult and impossible for them to bare his medical expenses anymore. Because of the money needed to transplant (12 million BDT), it is his family's decision to go with the surgery (3 million BDT). We must help them financially by raising money. But we must not be confined with that amount only to do the surgery. We must go for the transplant. Our target will be to collect as much as possible to help our friend.

In this problem, you have to build a software that can calculate the donations. Initially, the total amount of money is 0, and each time, two types of operations will be there:

  1. donate K” (100 ≤ K ≤ 105): you have to add K to the account.
  2. report”: report all the money currently in the account.

Input Specification

The first line of the input will contain T (1 ≤ T ≤ 100), denoting the number of operations. Then there will be T lines, each containing two types of operations as given above. You may assume that the input follows the restrictions described above.

Output Specification

For each “report” operation, print the total amount of money in the account on a line by itself.

Sample Input

  1. 4
  2. donate 1000
  3. report
  4. donate 500
  5. report
download as text file

Output for Sample Input

  1. 1000
  2. 1500
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019