#d2878. 简单差分
简单差分
Simple Difference Array
Problem Description
You are given an array of length . Perform the following operations times:
Select an interval and add the integer to every number in that interval.
After all operations are done, answer queries:
Each query gives an interval and asks for the sum of all numbers in that interval.
Input Format
The first line contains three positive integers .
The next line contains numbers, the array .
The next lines each contain three integers .
The next lines each contain two integers .
Output Format
Output lines, each containing one number — the sum for the corresponding query.
Sample Input
10 1 1
1 2 3 4 5 6 7 8 9 10
5 8 1
8 9
Sample Output
18
Constraints
For all data: , , .