You know 8Mao has his own Slime Team. But he soon found that let the Slimes stand in a line and make them from low to high is a such stupid thing since the Slimes are so f[bi][bi]king stupid!
As a result, 8Mao decided to give up.
But 8Mao still want his Slime Team be beautiful. So he got up another idea, let his Slimes grow up. He got some medicine that can make the Slimes in the line get higher. But only can let continuous Slimes.
8Mao thought that the variance of the heights of Slimes in the line is smaller, the Slime Team is more beautiful.
You have to help 8Mao to calculate out the variance of Slimes in a continuous sequence.
This problem contains several cases, ends with EOF.
The first line of each case contains 2 integers N and M which N indicates the number of Slimes and the number of operations.
Next line contains the heights of each Slimes ordered from 0 ~ N - 1. (0 < height <= 100, 000)
Then M lines followed. Each line indicates one operation.
If the operator is "1", then follows 3 integers A, B and C which indicate the start number of the Slimes and the end number of the Slimes and the heights the Slimes between A and B will increase.
If the operator is "2", then follows 2 integers A and B, you have to calculate out the variance of heights between Slime A and Slime B.
For each operator "2", you should output the variance. (The answer should be formatted to integer)
1 4 3 2 5
2 0 4
1 1 2 2
2 0 4