/*
区间修改, 单点查询
思想 : 差分数组
方法 : 前缀差分后缀和
*/
#include<bits/stdc++.h>
using namespace std;
int n, m, a[10000010], b[10000010];
int lb(int x)
{
return x & (-x);
}
long long getsum(int pos)
{
long long ans = 0;
for(int i = pos; i <= n; i += lb(i))
{
ans += b[i];
}
return ans;
}
void updata(int l, int r, int val)
{
for(int i = r; i > 0; i -= lb(i))
{
b[i] += val;
}
for(int i = l - 1; i > 0; i -= lb(i))
{
b[i] -= val;
}
}
int main()
{
scanf("%d%d", &n, &m);
for(int i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
}
for(int i = 1, q, c, d, e; i <= m; i++)
{
scanf("%d", &q);
if(q == 1)
{
scanf("%d%d%d", &c, &d, &e);
updata(c, d, e);
}
else
{
scanf("%d", &c);
printf("%lld\n", (long long)a[c] + getsum(c));
}
}
return 0;
}