1 #include<iostream>
2 #include<cstdio>
3 #define lson l , m , rt << 1
4 #define rson m+1, r , rt << 1 | 1
5 #define LL long long
6 using namespace std;
7
8 const int N = 100010 ;
9
10 int add[N<<2];
11 int sum[N<<2];
12 int n,q;
13
14 void pushup(int rt)
15 {
16 sum[rt] = sum[rt<<1] + sum[rt<<1|1] ;
17 }
18 void pushdown(int rt,int m) //rt线段,m长度
19 {
20 if (add[rt])
21 {
22 add[rt<<1] += add[rt];
23 add[rt<<1|1] += add[rt];
24 sum[rt<<1] += add[rt] * (m - (m >> 1));
25 sum[rt<<1|1] += add[rt] * (m >> 1);
26 add[rt] = 0;
27 }
28 }
29 void build(int l,int r,int rt)
30 {
31 add[rt] = 0;
32 if (l == r)
33 {
34 scanf("%lld",&sum[rt]);
35 return ;
36 }
37 int m = (l + r) >> 1;
38 build(lson);
39 build(rson);
40 pushup(rt);
41 }
42 void update(int L,int R,int c,int l,int r,int rt) //[L,R]的区间加上c
43 {
44 if (L <= l && r <= R)
45 {
46 add[rt] += c;
47 sum[rt] += (LL)c * (r - l + 1);
48 return ;
49 }
50 pushdown(rt , r - l + 1);
51 int m = (l + r) >> 1;
52 if (L <= m) update(L , R , c , lson);
53 if (m < R) update(L , R , c , rson);
54 pushup(rt);
55 }
56 LL query(int x,int l,int r,int rt)
57 {
58 if (x==l && x==r)
59 {
60 return sum[rt];
61 }
62 pushdown(rt , r - l + 1);
63 int m = (l + r) >> 1;
64 if (x <= m) return query(x , lson);
65 if (m < x) return query(x , rson);
66 }
67 int main()
68 {
69 scanf("%d",&n);
70 build(1,n,1);
71 scanf("%d",&q);
72 while(q--)
73 {
74 int a,b,x,y;
75 scanf("%d",&a);
76 if(a==1)
77 {
78 scanf("%d%d%d",&x,&y,&b);
79 update(x,y,b,1,n,1);
80 }
81 else
82 {
83 scanf("%d",&b);
84 printf("%lld\n",query(b,1,n,1));
85 }
86 }
87 return 0;
88 }