Household Ledger (Easy)

Maintain a ledger over N days with point additions and range-sum queries, printing the sum of entries from day p to day q.

Easy3Prefix sumArrayInterviewNo attempts yetTime limit1sMemory limit512 MB

Problem

Wolgok writes down every bit of income and spending by date. Managing that money matters a lot to him. He tried a ledger app on his phone, but he has lived so long that the app took forever to give him the number he wanted. Re-entering a record he had forgotten and recomputing was slow too, and Wolgok, who has no patience, smashed the phone. Write the program that helps him.

The program handles two operations. The first adds one income or spending entry on day pp of Wolgok's life. Income arrives as a positive number and spending as a negative number. The second computes and prints how much the balance changed from day pp through day qq. Wolgok may be in debt, so the balance on some day ii can be negative.

Input

The first line contains the number of days NN that Wolgok has lived and the number of queries QQ. (1N1041 \le N \le 10^4, 1Q1031 \le Q \le 10^3)

Each of the next QQ lines holds a query in one of these two forms.

  • 1 p x : add xx on day pp. (1pN1 \le p \le N, 2×109x2×109-2 \times 10^9 \le x \le 2 \times 10^9)
  • 2 p q : print the total change from day pp through day qq. (1pqN1 \le p \le q \le N)

Output

For each 2 query, print the computed value on its own line, in the order the queries are given.