In the land of UTS, the government has started to automate the taxes of their citizens. To function properly, this automated system needs to know the total revenue of every citizen by the end of the year. As such, the government has hired you to figure this out for them!
At the start of the year, the
Please help the government find the total revenue of each citizen by the end of the year.
Constraints
For this problem, you MUST pass the sample case in order to receive points. In addition, you must pass all previous subtasks to earn points for a specific subtask.
For all subtasks:
Subtask 1 [10%]
Subtask 2 [90%]
No additional constraints.
Input Specification
The first line of input contains
The next line of input contains
The next
indicating that the salaries of the citizens numbered from to increased by . indicating that the citizens numbered from to received their salaries as revenue.
Output Specification
Output
Sample Input
5 5
1 -3 7 4 2
1 2 3 -2
2 3 4
1 1 5 3
2 3 5
2 1 5
Sample Output
4 -2 21 18 10
Explanation
Initially, the list of salaries is
In the first operation, the citizens in the range
In the second operation, the citizens in the range
In the third operation, the citizens in the range
In the fourth operation, the citizens in the range
In the fifth operation, the citizens in the range
At the end of the year, the list of revenues is
Comments