Олимпиадный тренинг

Задача 38778. Air balloons


Задача

Темы: Словари
The Spring Festival is coming to the Flower City. For the holiday, it was decided to inflate a large number of balloons. Each shorty got an unlimited supply of balloons. To speed up the counting of inflated balloons, Vintik and Shpuntik invented a robot that keeps count of all inflated balloons.

Each shorty, at the moment when a robot is next to him, can do one of two things.
  1. Press button 1, say your name and say how many balloons he blew up (say a positive number) or how many balloons he burst (say a negative number). After that, the robot counts the number of inflated balloons this shorty has.
  2. Press button 2, say the name of any shorty. After that, the robot shows on the screen the number of inflated balloons for the specified shorty.  If the robot has never passed the specified shorty (didn't remember its balls), then the robot outputs the word ERROR.
Please note that in a situation where the shorty burst exactly as many balloons as he inflated, the sum of the robot becomes equal to 0; but, since the robot has already counted its balls, a zero value is not a reason to display ERROR.

At the beginning, all shorties have 0 inflated balloons. Any shorty can accidentally pop someone else's balloons. Therefore, the score of balls for any shorty can be both positive and negative.  
The robot can pass any shorty any number of times.
After driving past the specified number of shorties, the robot displays the total number of inflated balloons.

Help Vintin and Shpuntik write a program for the robot. Be sure to use dictionaries (associative arrays)

Input
The program receives as input the number of requests N (1 < N < 100000) - the number of shorties that the robot must pass by. This is followed by N lines, each of which describes how to select buttons shorty.
Line formats:
- when button 1 is pressed: 1 <name> <number>;
- on button 2 click: 2 <name>.
<name> - any sequence of Latin characters.


Imprint
When button 2 is pressed, the program should display, on a new line, the current value of balloons for the specified shorty (or the word ERROR). In the last line, print the total number of inflated balloons by all shorties.

 
Example
# Input Output
1
7
1 neznayka 3
1 donut 5
2 neznayka
1 neznayka-2
2 neznayka
2 lala
2 donuts
3
1
ERROR
5
6