Retroactive Raises
The payroll service stores the monthly salary of n employees, whose ids are 1 to n. Ids were
handed out by team, so an id range like [l, r] is how HR addresses a department. Employee i
starts with a salary of s_i cents.
HR then sends q commands, which must be applied in the order they arrive:
raise l r v: every employee whose id lies in[l, r](both ends included) hasvcents added to their salary.vmay be negative (a correction that claws back an earlier raise), and salaries may temporarily become zero or negative; store them as they are.salary i: report the current salary of employeeiin cents, taking into account everyraisecommand received so far.
Answer every salary command.
Input
The first line contains two integers n and q (1 ≤ n ≤ 2·10^5, 1 ≤ q ≤ 2·10^5): the number of
employees and the number of commands.
The second line contains n integers s_1, s_2, …, s_n (0 ≤ s_i ≤ 10^9): the starting salaries.
Each of the next q lines contains one command, either raise l r v (1 ≤ l ≤ r ≤ n,
−10^9 ≤ v ≤ 10^9) or salary i (1 ≤ i ≤ n). The command name is written exactly as shown, in
lowercase.
Output
For each salary command, in the order they arrive, print one line with the requested salary in
cents. If there are no salary commands, print nothing.
Notes
In the first example the salaries start as 100 200 300 400 500. The raise of 50 for ids 2..4
makes them 100 250 350 450 500, so employee 3 earns 350. The correction of −100 for ids
1..2 makes them 0 150 350 450 500.
In the second example the raises overlap, and salaries quickly stop fitting in a 32-bit integer.