- People purchase food all throughout the day at the canteen. And it becomes difficult to keep track of all the purchases. To counter this, the owners decided to write every purchase and expenditure in a book. But even this becomes tedious because of thousands of purchases happening every day.
Now the canteen owners are asking for your help to design a simple app to make note of purchases and expenditures and give closing balance at the end of the day. The app only has two commands - GET and GIVE.
There are N purchases every day, and GET indicates when money comes in because of a sale and GIVE indicates money going out.Sometimes there may be spelling mistakes in commands. If you find spelling mistakes, ignore them.
Assume that starting balance = 0.
|First line will contain N, number of transactions. Then the transactions follow.
Each transaction contains of a command - GET or GIVE followed by the amount after a single space.
|Print the closing balance.|
- 1 ≤ N ≤ 1000
- 1 ≤ Transaction Amount ≤ 1000