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