#include<cstdio>
#define int long long
struct node{
int first,last,sum,addtag,multag;
bool flag;
node(void){
first=0;
last=0;
sum=0;
addtag=0;
multag=0;
flag=false;
};
};
node tree[400004];
inline void pushdown(int root){
if(tree[root].flag){
tree[root<<1].addtag+=tree[root].addtag;
tree[root<<1].multag+=tree[root].multag;
tree[root<<1].flag=true;
tree[root<<1|1].addtag+=tree[root].addtag+(tree[root<<1|1].first-tree[root<<1].first)*tree[root].multag;
tree[root<<1|1].multag+=tree[root].multag;
tree[root<<1|1].flag=true;
};
tree[root].flag=false;
tree[root].addtag=0;
tree[root].multag=0;
return;
};
inline void build(int root,int first,int last){
tree[root].first=first;
tree[root].last=last;
if(first==last){
scanf("%lld",&tree[first].sum);
return;
};
int middle=first+last>>1;
build(root<<1,first,middle);
build(root<<1|1,middle+1,last);
return;
};
inline void change(int root,int first,int last,int addtag,int multag){
if(first<=tree[root].first&&tree[root].last<=last){
tree[root].flag=true;
tree[root].addtag+=addtag+(tree[root].first-first)*multag;
tree[root].multag+=multag;
return;
};
pushdown(root);
int middle=tree[root].first+tree[root].last>>1;
if(first<=middle){
change(root<<1,first,last,addtag,multag);
};
if(middle<last){
change(root<<1|1,first,last,addtag,multag);
};
return;
};
inline int query(int root,int found){
if(tree[root].first==tree[root].last){
tree[root].sum+=tree[root].addtag;
tree[root].addtag=0;
tree[root].multag=0;
return tree[root].sum;
};
pushdown(root);
int middle=tree[root].first+tree[root].last>>1;
if(found<=middle){
return query(root<<1,found);
};
return query(root<<1|1,found);
};
signed main(signed argc,char **argv){
int size,action;
scanf("%lld %lld",&size,&action);
build(1,1,size);
do{
int symbol;
scanf("%lld",&symbol);
if(symbol==1){
int first,last,addtag,multag;
scanf("%lld %lld %lld %lld",&first,&last,&addtag,&multag);
change(1,first,last,addtag,multag);
}else{
int found;
scanf("%lld",&found);
printf("%lld\n",query(1,found));
};
}while(--action);
return 0;
};