Mines

아직 제출이 없습니다시간 제한3초메모리 제한256 MB

문제

There are NN mines on the number line. Mine ii is at position p_ip\_i and has an explosion radius r_ir\_i. It initially costs c_ic\_i to detonate. If mine ii is detonated, an explosion occurs on interval \[p_ir_i,p_i+r_i]\[p\_i - r\_i, p\_i + r\_i] and all mines in that interval (inclusive of the endpoints) are detonated for free, setting off a chain reaction. You need to process QQ operations of the form (m,c)(m,c): Change the cost of detonating mine mm to cc. Output the minimum cost required to detonate all mines after each change. Note that each change is permanent.

입력

The first line contains integers NN and QQ (1N,Q200,0001 \leq N, Q \leq 200\\,000). The next NN lines contain information on the mines. The ii-th of these lines contains integers p_ip\_i, r_ir\_i and c_ic\_i (1p_i,r_i,c_i1091 \leq p\_i,r\_i,c\_i \leq 10^9). The next QQ lines each contains space separated integers mm and cc (1mN1 \leq m \leq N, 1c1091 \leq c \leq 10^9).

출력

Output QQ lines. The ii-th line should contain the minimum cost required to detonate all mines after the ii-th operation.