Range Sum Queries 2

You are given an array of n elements and q queries. There are two types of queries:
  1. Get the sum of a given range
  1. Update the array element at the given position
Your task is to process the queries efficiently.

Input

The first line of the input contains two integers n and q (1 ≀ n, q ≀ 100 000), representing the number of elements in the array and the number of queries, respectively.
The second line contains n space-separated integers (), representing the initial elements of the array.
The following q lines each represent a query:
  1. For range sum queries: The line starts with the number 1 followed by two integers and (), representing the range of indices [] for which the sum of elements needs to be calculated.
  1. For array update queries: The line starts with the number 2 followed by two integers and (), representing the index of the element to be updated and its new value .

Output

For each range sum query, print the sum of the values within the given range on separate lines.

Examples

Input
Output
5 3 1 2 3 4 5 1 1 3 1 2 4 1 1 5
6 9 15
5 3 1 2 3 4 5 1 1 3 2 1 5 1 1 5
6 19

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue