#include<iostream>
using namespace std;
const int N = 1e6+10;
typedef long long ll;
int n,m;
ll c[N];
ll lowbit(ll x)
{
return x&(-x);
}
void updata(ll i,ll k)
{
while(i<=n)
{
c[i]+=k;
i+=lowbit(i);
}
}
ll getsum(ll i)
{
ll res=0;
while(i>0)
{
res+=c[i];
i-=lowbit(i);
}
return res;
}
int main()
{
int now=0,last=0;
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>now;
updata(i,now-last);
last=now;
}
while(m--)
{
int k,l,r,x,i;
cin>>k;
if(k==1)
{
cin>>l>>r>>x;
updata(l,x);updata(r+1,-x);
}
else
{
cin>>i;
cout<<getsum(i)<<endl;
}
}
return 0;
}