#ds101. 树状数组1

树状数组1

Fenwick Tree 1

Problem Description

You are given nn numbers a1,a2,a3,…,ana_1, a_2, a_3, \dots, a_n.

Support qq operations:

  1. 1 x d: set ax=da_x = d.
  2. 2 x: query ∑i=1xai\sum_{i=1} ^x a_i.

Input Format

The first line contains two integers n,qn, q (1≤n,q≤2×1051\leq n, q\leq 2 \times 10^5).

The next line contains nn integers a1,a2,…,ana_1, a_2, \dots, a_n (1≤ai≤1091\leq a_i\leq 10^9).

The next qq lines each contain an operation of the form 1 x d or 2 x, with 1≤x≤n1\leq x\leq n and 1≤d≤1091\leq d\leq 10^9 guaranteed.

Output Format

For each query, output one line containing the answer.

Sample Input

5 5
1 2 3 4 5
2 4
1 1 5
2 5
1 2 3
2 3

Sample Output

10
19
11