This problem is a Mooshak version of a SPOJ Problem.


[PC023] Horrible Queries

World is getting more evil and it's getting tougher to get into the Evil League of Evil. Since the legendary Bad Horse has retired, now you have to correctly answer the evil questions of Dr. Horrible, who has a PhD in horribleness (but not in Computer Science). You are given an array of \(N\) elements, which are initially all 0. After that you will be given \(C\) commands. They are:

Input

The first line contains \(N \) and \(C\). After that you'll be given \(C\) commands in the format mentioned above.

Output

Print the answers of the queries, one per line.

Constraints

Example Input Example Output
1
8 6
0 2 4 26
0 4 8 80
0 4 5 20
1 8 8 
0 5 7 14
1 4 8
80
508

Competitive Programming (CC3032) 2025/2026
DCC/FCUP - University of Porto