RSQ Queries
Time limit: 2 secMemory limit: 256 MBData Structures, Math, Dynamic Programming
Problem Statement
Given an array of integers and queries. There are 2 types of queries:
- - set value at position by (array is 1-indexed)
- - find sum on subsegment from to
It is guaranteed that queries are valid.
Input Format
In first line of input is . In the second line of input there are elements of array. .
In the third line . In the next 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.