#P2781. 传教

传教

Description

pear lines up the people who are about to receive preaching in a row, numbered from left to right as 1n1 \sim n. Each person has a faith value, and initially all faith values are 00. Then pear will perform one of the following two operations:

  1. pear preaches to a continuous segment of people. Specifically, pear will increase the faith value of every person from the ll-th to the rr-th person by kk.

  2. pear wants to know the sum of faith values over a segment to see whether the "Quanling spirit" has taken root. Specifically, pear will ask bx2k for the sum of the faith values of all people from the ll-th to the rr-th person.

As a believer in the "Quanling spirit," bx2k naturally wants to help pear calculate. However, bx2k is too clumsy to do the math, so he is asking you for help.

Input Format

The first line contains two integers n,mn, m, representing the number of people receiving preaching and the number of operations by pear, respectively.

The next mm lines each contain several integers. If the first integer is 11, it means pear is preaching, and this line will then contain three integers l,r,kl, r, k. Otherwise, if the first integer is 22, it means pear is making a query, and this line will then contain two integers l,rl, r.

Output Format

Output several lines, each containing 11 integer, representing the answer to pear’s query. The number of lines equals the number of queries.

5 5
2 1 2
1 4 4 2
1 2 4 7
1 4 5 6
2 3 4
0
22

Hint

Sample explanation: Initially, everyone’s faith value is 00, so the answer is 00. By the time of the fifth operation, the five people’s faith values are 0,7,7,15,60, 7, 7, 15, 6. Thus, the answer is 7+15=227 + 15 = 22.

Constraints: | Test point | n,mn, m | Special property | |:-:|:-:|:-:| | 131 \sim 3 | 10\le 10 | None | | 454 \sim 5 | 103\le 10^3 | None | | 686 \sim 8 | 109\le 10^9 | Special property A |

Special property A: No preaching operations.

For all test points, n109n \le 10^9, m103m \le 10^3, 1ln1 \le l \le n, 1rn1 \le r \le n, k10k \le 10.

Translated by ChatGPT 5