Range Additions


You are given an array of nn integers.

Then qq queries follow. Each query contains three integers l,r,xl, r, x and means to add xx to every element from ll to rr, inclusive.

After processing all queries, print the final array.

Input

The first line contains two integers nn and qq, the length of the array and the number of queries.

The second line contains nn integers: a1,a2,…,ana_1, a_2, \ldots, a_n.

Each of the next qq lines contains three integers l,r,xl, r, x, meaning add xx to every element al,al+1,…,ara_l, a_{l + 1}, \ldots, a_r.

Output

Print nn space-separated integers: the final contents of the array after all qq queries are applied.

Constraints

  • 1≤n≤2⋅1051 \le n \le 2 \cdot 10^5
  • 0≤q≤2⋅1050 \le q \le 2 \cdot 10^5
  • 1≤l≤r≤n1 \le l \le r \le n
  • −109≤ai≤109-10^9 \le a_i \le 10^9
  • −109≤x≤109-10^9 \le x \le 10^9

Example 1

Input 1
5 3
1 2 3 4 5
1 3 2
2 5 -1
4 4 7
Output 1
3 3 4 10 4
Explanation

After the three updates, the array becomes [3,3,4,10,4][3, 3, 4, 10, 4].

Example 2

Input 2
6 4
0 0 0 0 0 0
1 6 5
2 4 -3
3 3 10
6 6 -2
Output 2
5 2 12 2 5 3

Example 3

Input 3
4 0
8 -3 14 1
Output 3
8 -3 14 1

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.