#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
namespace IO
{
template<typename T>void write(T x)
{
if(x<0)
{
putchar('-');
x=-x;
}
if(x>9) write(x/10);
putchar(x%10+'0');
}
template<typename T> void read(T &x)
{
x = 0;char ch = getchar();int f = 1;
while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
while(isdigit(ch)){x = x*10+(ch-'0');ch=getchar();}x*=f;
}
};
using namespace IO;
LL tree[500001];//树状数组
LL A[500001];//原始区间序列
//LL B[500001];//差分数组
LL n,m;
inline LL lowbit(LL x){//本质是2^0,2^1...2^n
//一个非负整数n在二进制下的最低为1及其后面的0构成的数
//(101100)2 --> 100;
//(110010)2 --> 10;
return x&(-x);
}
inline void update(LL x,LL value){//A[x]+value
A[x]+=value;
while (x<=n){
tree[x]+=value;
x+=lowbit(x);
}
}
inline LL getval(LL x){
LL ans=0;
while (x>0){
ans+=tree[x];
x-=lowbit(x);
}
return ans;
}
inline LL modify(LL left,LL right){//左右区间,查询left-right区间值的和
LL ans=0;
ans+=getval(right)-getval(left-1);
return ans;
}
signed main()
{
memset(A,0,sizeof A);
memset(tree,0,sizeof tree);
LL val;LL op,x,y,k;LL save=0;
cin>>n>>m;
for (LL i=1;i<=n;i++){
cin>>val;
update(i,val-save);
save=val;
}
for (LL i=1;i<=m;i++){
cin>>op;
if (op==1) {
cin>>x>>y>>k;
update(x,k);
update(y+1,-k);
}
else{
cin>>k;
cout<<modify(1,k)<<endl;
}
}
return 0;
}