1 #include<cstdio>
2 #include<iostream>
3 #include<cmath>
4 #define maxn 1000000
5 using namespace std;
6
7 int block[maxn],size,arr[maxn],sum[maxn],n,q,a,b,c;
8
9 int query(int a,int b){
10 int ans = 0;
11 for(int i = a;i <= min(block[a]*size-1,b);i++)
12 ans += arr[i];
13 if(block[a] != block[b])
14 for(int i = (block[b]-1)*size;i <= b;i++)
15 ans += arr[i];
16 for(int i = block[a]+1;i < block[b];i++)
17 ans += sum[i];
18 return ans;
19 }
20
21 int main(){
22 scanf("%d",&n);
23 size = (int)sqrt(n)+1;
24 for(int i = 0;i < n;i++) block[i] = i/size+1;
25 for(int i = 0;i < n;i++) scanf("%d",&arr[i]);
26 for(int i = 0;i < n;i++) sum[block[i]] += arr[i];
27 scanf("%d",&q);
28 for(int i = 0;i < q;i++){
29 scanf("%d%d%d",&a,&b,&c);
30 if(a%2) arr[b-1] += c,sum[block[b-1]] += c;
31 else printf("%d\\n",query(b-1,c-1));
32 }
33
34 // printf("#size: %d\\n",size);
35 // for(int i = 0;i < n;i++) printf("#%d: block%d\\n",i,block[i]);
36 // for(int i = 1;i <= n;i++) printf("#%d: ->%d\\n",i,sum[i]);
37
38 return 0;
39 }