A farm has
There are
After applying all
The first line contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression — the number of plots and the number of irrigation operations.
Each of the next KaTeX can only parse string typed expression lines contains three integers KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, and KaTeX can only parse string typed expression.
Print KaTeX can only parse string typed expression integers separated by spaces — the final water level of each plot, in order.
Input
5 3
0 2 5
1 4 -2
2 2 10Output5 3 13 -2 -2ExplanationStart with KaTeX can only parse string typed expression. After the first operation: KaTeX can only parse string typed expression. After the second: KaTeX can only parse string typed expression. After the third: KaTeX can only parse string typed expression.
Example 2:
Input
1 1
0 0 100Output100ExplanationWith a single plot and a single operation covering it, the final level is simply KaTeX can only parse string typed expression.
Example 3:
Input
10 0Output0 0 0 0 0 0 0 0 0 0ExplanationWith no operations at all, every plot remains at its initial level of KaTeX can only parse string typed expression.