Panama Sum

Time limit: 0.5s Memory limit: 256MB Input: Output:

Task

While their car was lost in Panama, Carlos and Pablo decided to have fun with some math. One day, Carlos came up with what he called a Panama sum.

Basically, a Panama sum is the sum of some values in an 11-indexed array, where the values on the odd positions are added to the sum and the values on the even positions are subtracted from the sum.

For example, the Panama sum of the array [10,6,9,4,2,0][10, 6, 9, 4, 2, 0] is 1010 - 66 + 99 - 44 + 22 - 00 which is equal to 1111

Because finding this is way too easy for Pablo (he is a programmer), he decided to make this challenge more difficult.

Therefore, he invented the maximum Panama sum, which is defined as the maximum Panama sum we can get if we select a non-empty subarray from a given array.

Now he wants Carlos to find this value for multiple queries which might involve changing some values as well.

Help Carlos get this problem done and he will take you for a ride once he finds his car!

Input

The first line of the input consists of two integers, nn and qq.

The second line of the input consists of nn integers, representing the initial array vv.

The next qq lines of the input contain the queries you are given.

On each line, you will get the description of a query, which can be of two types:

1 a b1 \ a \ b - the value on position aa is changed to bb.

2 l r2 \ l \ r - find the maximum Panama sum of the subarray [l,r][l, r].

Output

The output will contain as many lines as queries of type 22 exist in the input (there is at least one query of type 22). Each line will contain the answer to a query, in the order they were given in the input.

Restrictions

  • 1n,q1051 \leq n, q \leq 10^5
  • 0v[i],b1090 \leq v[i], b \leq 10^9
  • For tests worth 2020 points, 1n1001 \leq n \leq 100, 1q10001 \leq q \leq 1000.
  • For tests worth 2020 more points, 1n50001 \leq n \leq 5000, 1q50001 \leq q \leq 5000.

Example

stdin

10 6
5 9 1 2 3 4 6 4 2 8
2 3 7
2 4 10
2 6 9
1 5 8
2 1 10
2 4 6

stdout

6
10
6
10
8

Log in or sign up to be able to send submissions!