An arena tracks cumulative player scores. Starting with no players, it processes q operations, each one of:
ADD player score— addscore(a positive integer) toplayer's total, creating the player with that score if they are new.TOP k— report the sum of thekhighest current player totals. It is guaranteed at leastkplayers currently exist.RESET player— removeplayerfrom the board entirely. It is guaranteed the player exists.
Player names are non-empty tokens of lowercase letters and digits.
Input format
Line 1: an integer q.
Next q lines: ADD player score, TOP k, or RESET player.
Output format
For each TOP operation, in order, print the sum of the k highest totals.
Constraints
- 1 <= q <= 40
- 1 <= score <= 1000000
- 1 <= k <= current number of players
- 1 <= length of player <= 12