RSQ Queries

Time limit: 2 secMemory limit: 256 MBData Structures, Math, Dynamic Programming

Problem Statement

Given an array of NN integers and QQ queries. There are 2 types of queries:

  1. pospos valval - set value at position pospos by valval (array is 1-indexed)
  2. ll rr - find sum on subsegment from ll to rr
    It is guaranteed that queries are valid.

Input Format

In first line of input is N105N \leq 10^{5}. In the second line of input there are elements of array. 0elements1090 \leq elements \leq 10^{9}.
In the third line Q105Q \leq 10^{5}. In the next QQ lines there are queries.

Output Format

For each queries of second type print the sum.

Examples

Input

3
1 2 3
3
2 1 3
1 1 3
2 1 3

Output

6
8

Code Editor

Submit a solution. Authentication is required to create submissions.

Language
Theme
Source code is submitted to the judge for testing.