#include<cstdio>
#include<algorithm>
#define f(i,a,b) for(int i=a;i<=b;i++)
#define read(x) scanf("%d",&x)
using namespace std;
const int N=2e5+5;
int n,m,op,p,l,r,k,e,a[N],d[4*N],tag[4*N];
void pd(int s,int t,int p)
{
int tg=tag[p],m=(s+t)>>1;
d[p*2]+=tg*(m-s+1);
d[p*2+1]+=tg*(t-m);
tag[p*2]+=tg;
tag[p*2+1]+=tg;
tag[p]=0;
}
void build(int p,int s,int t)
{
if(s==t)
{
d[p]=a[s]-a[s-1];
return;
}
int m=(s+t)>>1;
build(p*2,s,m);
build(p*2+1,m+1,t);
d[p]=d[p*2]+d[p*2+1];
}
void update(int l,int r,int c,int s,int t,int p)
{
if(l<=s&&t<=r)
{
d[p]+=(t-s+1)*c;
tag[p]+=c;
return;
}
if(s!=t&&tag[p]) pd(s,t,p);
int m=(s+t)>>1;
if(l<=m) update(l,r,c,s,m,p*2);
if(r>m) update(l,r,c,m+1,t,p*2+1);
d[p]=d[p*2]+d[p*2+1];
}
int sum(int l,int r,int s,int t,int p)
{
if(l<=s&&t<=r) return d[p];
if(tag[p]) pd(s,t,p);
int res=0,m=(s+t)>>1;
if(l<=m) res+=sum(l,r,s,m,p*2);
if(r>m) res+=sum(l,r,m+1,t,p*2+1);
return res;
}
int main()
{
read(n),read(m);
f(i,1,n) read(a[i]);
build(1,1,n);
f(i,1,m)
{
read(op);
if(op==1)
{
read(l),read(r),read(k),read(e);
update(l,l,k,1,n,1);
if(r>l) update(l+1,r,e,1,n,1);
if(r<n) update(r+1,r+1,-k-(r-l)*e,1,n,1);
}
else read(p),printf("%d\n",sum(1,p,1,n,1));
}
return 0;
}