| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 7 초 | 512 MB | 685 | 77 | 32 | 6.324% |
Yuta has an array $A_1,ドル $A_2,ドル $\ldots,ドル $A_n$ with $n$ integers, and he keeps a copy of the initial contents of array $A$ as $A'$ (initially, $A'_i = A_i$). Then he executes $m$ operations on the array $A$.
There are three types of operations:
for (int i = l; i <= r; i++) A[i] = A[i - k];Help Yuta execute all the given operations.
The first line of the input contains two integers $n$ and $m$ (1ドル \leq n, m \leq 2 \cdot 10^5$).
The second line contains $n$ integers $A_i$ (0ドル \leq A_i \leq 10^9$).
Then $m$ lines follow, each line describes an operation in the format shown above. It is guaranteed that 1ドル \le l \le r \le n$ and 1ドル \leq k < l$.
For each operation of the first type, print a single line with a single integer: the required sum.
5 7 1 2 3 4 5 1 1 5 2 3 4 1 1 1 5 2 3 4 2 1 1 5 3 1 5 1 1 5
15 12 11 15