Live Scoreboard


Submit solution

Points: 10
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

Live Scoreboard

Maintain player scores under ADD, GET, and REMOVE commands. A missing player has score zero. ADD creates a missing player; REMOVE silently does nothing when the player is absent.

Input

The first line contains q (1 ≤ q ≤ 200000). Commands are ADD name delta, GET name, or REMOVE name. Names are lowercase and |delta| ≤ 10^9.

Output

For every GET command, print the current score on its own line.

Example 1

Input

9
ADD alice 5
ADD bob 3
GET alice
ADD alice -2
GET alice
REMOVE bob
GET bob
REMOVE nobody
GET nobody

Output

5
3
0
0

Example 2

Input

6
GET a
ADD a -7
GET a
REMOVE a
GET a
ADD a 10

Output

0
-7
0


Comments

There are no comments at the moment.