#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <string>
#define ll long long
#define ld long double
#define sqr(a) (a)*(a)
#define mp make_pair
#define pb push_back
#define pi pair<int,int>
#define x first
#define y second
#define inf (int)1e9
using namespace std;
const int N=1000001;
int n,m,x,t,l,r;
int tree[N],a[N];
void update(int i,int delta)
{
for(;i<n;i=(i|(i+1)))
tree[i]+=delta;
}
int get(int r)
{
int res=0;
for(;r>=0;r=(r&(r+1))-1)
res+=tree[r];
return res;
}
int main()
{
freopen("segmentupdate.in","r",stdin);
freopen("segmentupdate.out","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>m;
for(int i=0;i<n;i++)
cin>>a[i];
while(m--)
{
cin>>t;
if(t==1)
{
cin>>l>>r>>x;
l--,r--;
update(l,x);
update(r+1,-x);
}else {
cin>>x;
x--;
cout<<a[x]+get(x)<<"\n";
//printf("%d\n",a[x]+get(x));
}
}
return 0;
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KI2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxjc3RkaW8+CiNpbmNsdWRlIDxjY3R5cGU+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxxdWV1ZT4KI2luY2x1ZGUgPGRlcXVlPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDxzZXQ+CiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxzdHJpbmc+CiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgbGQgbG9uZyBkb3VibGUKI2RlZmluZSBzcXIoYSkgKGEpKihhKQojZGVmaW5lIG1wIG1ha2VfcGFpcgojZGVmaW5lIHBiIHB1c2hfYmFjawojZGVmaW5lIHBpIHBhaXI8aW50LGludD4KI2RlZmluZSB4IGZpcnN0CiNkZWZpbmUgeSBzZWNvbmQKI2RlZmluZSBpbmYgKGludCkxZTkKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY29uc3QgaW50IE49MTAwMDAwMTsKaW50IG4sbSx4LHQsbCxyOwppbnQgdHJlZVtOXSxhW05dOwp2b2lkIHVwZGF0ZShpbnQgaSxpbnQgZGVsdGEpCnsKICAgIGZvcig7aTxuO2k9KGl8KGkrMSkpKQogICAgICAgIHRyZWVbaV0rPWRlbHRhOwp9CmludCBnZXQoaW50IHIpCnsKICAgIGludCByZXM9MDsKICAgIGZvcig7cj49MDtyPShyJihyKzEpKS0xKQogICAgICAgIHJlcys9dHJlZVtyXTsKICAgIHJldHVybiByZXM7Cn0KCmludCBtYWluKCkKewogICAgZnJlb3Blbigic2VnbWVudHVwZGF0ZS5pbiIsInIiLHN0ZGluKTsKICAgIGZyZW9wZW4oInNlZ21lbnR1cGRhdGUub3V0IiwidyIsc3Rkb3V0KTsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgY2luLnRpZShOVUxMKTsKICAgIGNpbj4+bj4+bTsKICAgIGZvcihpbnQgaT0wO2k8bjtpKyspCiAgICAgICAgY2luPj5hW2ldOwogICAgd2hpbGUobS0tKQogICAgewogICAgICAgIGNpbj4+dDsKICAgICAgICBpZih0PT0xKQogICAgICAgIHsKICAgICAgICAgICAgY2luPj5sPj5yPj54OwogICAgICAgICAgICBsLS0sci0tOwogICAgICAgICAgICB1cGRhdGUobCx4KTsKICAgICAgICAgICAgdXBkYXRlKHIrMSwteCk7CiAgICAgICAgfWVsc2UgewogICAgICAgICAgICBjaW4+Png7CiAgICAgICAgICAgIHgtLTsKICAgICAgICAgICAgY291dDw8YVt4XStnZXQoeCk8PCJcbiI7CiAgICAgICAgICAgIC8vcHJpbnRmKCIlZFxuIixhW3hdK2dldCh4KSk7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIDA7Cn0K