#ds204. 线段树打标记2
线段树打标记2
Segment Tree with Lazy Tags 2
Problem Description
You are given numbers .
Support operations:
1 l r d: add to all with .2 l r d: multiply all with by .3 l r d: set all with equal to .4 l r: query .
Input Format
The first line contains two integers ().
The next line contains integers ().
The next lines each contain an operation of the form 1 l r d, 2 l r d, 3 l r d, or 4 l r, with guaranteed.
Output Format
For each query, output one line containing the answer.
Sample Input
5 7
1 2 3 4 5
4 1 5
1 2 3 4
4 1 5
2 3 4 5
4 1 5
3 4 5 1
4 1 5
Sample Output
15
23
67
44