#include<bits/stdc++.h>
#define maxn 100005
#define LL long long
using namespace std;
int n,m,a[maxn],tag[4*maxn];
LL h[4*maxn];
inline int read(){
int ret=0;char f=1,ch=getchar();
while(!isdigit(ch)) f=(ch=='-'?-f:f),ch=getchar();
while(isdigit(ch)) ret=ret*10+ch-'0',ch=getchar();
return ret*f;
}
void build(int L,int R,int p){
if(L==R){h[p]=a[L];return;}
int mid=(L+R)>>1;
build(L,mid,p*2),build(mid+1,R,p*2+1);
h[p]=h[p*2]+h[p*2+1];
}
void f(int L,int R,int p,int k){
h[p]+=(R-L+1)*k;
tag[p]+=k;
}
void push_down(int L,int R,int p){
int mid=(L+R)>>1;
f(L,mid,p*2,tag[p]),f(mid+1,R,p*2+1,tag[p]);
tag[p]=0;
}
void add(int L,int R,int p,int l,int r,int k){
if(L>=l&&R<=r){h[p]+=(R-L+1)*k,tag[p]+=k;return;}
int mid=(L+R)>>1;push_down(L,R,p);
if(l<=mid) add(L,mid,p*2,l,r,k);
if(r>mid) add(mid+1,R,p*2+1,l,r,k);
h[p]=h[p*2]+h[p*2+1];
}
LL get(int L,int R,int p,int x){
if(L==R) return h[p];
int mid=(L+R)>>1;push_down(L,R,p);
if(x<=mid) return get(L,mid,p*2,x);
else return h[p*2]+get(mid+1,R,p*2+1,x);
}
int main(){
n=read(),m=read();
for(int i=1;i<=n;i++) a[i]=read();
for(int i=n;i>1;i--) a[i]-=a[i-1];
build(1,n,1);
for(int i=1;i<=m;i++){
int opt=read();
if(opt==1){
int x=read(),y=read(),k=read(),d=read();
add(1,n,1,x,x,k);
if(y>x) add(1,n,1,x+1,y,d);
add(1,n,1,y+1,y+1,-k-(y-x)*d);
}else{
int x=read();
printf("%lld\n",get(1,n,1,x));
}
}
return 0;
}