#SDNU1495. Problem_D

Problem_D

Description

An array with length nn is given.
You should support 2 types of operations.

1.xx yy change the xthx-th element to yy.
2.ll rr print the variance of the elements with indices l,l+1,...,rl, l + 1, ... , r.
As the result may not be an integer, you need print the result after multiplying (rl+1)2(r-l+1)^2.

The index of the array is from 1.

Format

Input

The first line is two integer n,m(1n,m216)n, m(1 \leq n, m \leq 2^{16}), indicating the length of the array and the number of operations.
The second line is nn integers, indicating the array. The elements of the array 0ai1040\leq a_i \leq 10^4. The following mm lines are the operations. It must be either 1 xx yy or 2 ll rr

Output

For each query, print the result.

Samples

4 4
1 2 3 4
2 1 4
1 2 4
2 1 4
2 2 4
20
24
2