#C1349. Athlete Race Time Tracker

    ID: 43033 Type: Default 1000ms 256MiB

Athlete Race Time Tracker

Athlete Race Time Tracker

The city is organizing an annual sports event where multiple athletes compete in various races. Each athlete is identified by a unique number, and in each race, the athlete records a time in seconds. You are given a sequence of queries to update and retrieve athletes' times.

There are two types of queries:

  • Type 1: "1 a r t" — Add an entry for athlete a with time t (in seconds) for race r. The race identifier r is provided but does not affect the query outcome.
  • Type 2: "2 a" — Output the total accumulated time of athlete a across all races. Formally, if athlete a has recorded times \(t_1, t_2, \dots, t_k\), then the total time \(T_a\) is given by: $$T_a = \sum_{i=1}^{k} t_i.$$

If an athlete has no recorded times when queried, output 0.

inputFormat

The first line contains an integer n which indicates the number of queries.

Each of the following n lines contains a query. A query is in one of the following formats:

  • Type 1: 1 a r t — where a and t are integers representing the athlete's identifier and time (in seconds), and r is the race identifier (unused in the calculation).
  • Type 2: 2 a — where a is an integer representing the athlete whose total time is to be output.

outputFormat

For each query of type 2, output a single line with the total time (in seconds) accumulated by the athlete. The output should be printed in the order the queries appear.

## sample
7
1 1 101 50
1 2 101 30
1 1 102 25
2 1
2 2
1 2 103 40
2 2
75

30 70

</p>