#K74642. Gaming System Score Management

    ID: 34243 Type: Default 1000ms 256MiB

Gaming System Score Management

Gaming System Score Management

You are given a gaming system that tracks the scores of players. Initially, you are provided with the scores of all players. After that, you need to process a number of queries. There are two types of queries:

  • 1 x v: Update the score of the player at the 1-indexed position x to v.
  • 2 l r: Compute the sum of scores for all players from position l to r (inclusive). The summation can be represented using the formula: $$ S = \sum_{i=l}^{r}{score_i} $$.

You must process the queries in the given order and output the result for every query of type 2.

inputFormat

The input is given as follows:

  1. An integer n representing the number of players.
  2. A line with n space‐separated integers where each integer represents the initial score of a player.
  3. An integer q representing the number of queries.
  4. q lines each containing a query in one of the two formats described above.

outputFormat

For each query of type 2, output the resulting sum on a new line.

## sample
5
10 20 30 40 50
3
1 3 35
2 2 4
2 1 5
95

155

</p>