RT
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 5e5 + 10;
int n, m;
int a[N], tr[N];
int opt, x, y, k;
int lowbit(int x) {
return x & -x;
}
void upd(int x, int p) {
for (int i = x; i <= n; i += lowbit(i)) {
tr[i] += p;
}
}
int query(int x) {
int res;
for (int i = x; i > 0; i -= lowbit(i)) {
res += tr[i];
}
return res;
}
signed main (void) {
cin >> n >> m;
for (int i = 1; i <= n; i ++) {
cin >> a[i];
}
while (m --) {
cin >> opt;
if(opt == 1) {
cin >> x >> y >> k;
upd(x, k);
upd(y + 1, -k);
}
if(opt == 2) {
cin >> x;
cout << query(x) + a[x] << endl;
}
}
return 0;
}