#include<iostream> #define ll long long using namespace std; const int N=1e6+10; ll a[N], t[N]; ll n, m; ll lowbit(int x) { return x & -x; } void add(int x, int y) { for(int i = x;i <= n;i += lowbit(i))t[i] += y; } void addd(int x,int y) { for(int i = x;i <= n;i += lowbit(i))t[i] -= y; } ll qurry(int x) { ll res = 0; for(int i = x;i > 0;i -=lowbit(i))res += t[i]; return res; } int main() { cin >> n >> m; for(int i = 1;i <= n ;i ++)cin >> a[i]; for(int i = 1;i <= n;i ++) { add(i, a[i] - a[i - 1]); } while(m --) { int k, x, y, z; cin >> k ; if(k == 1) { cin >> x >> y >> z; add(x, z); addd(y + 1, z); } else{ cin >> x; cout<<qurry(x)<<endl; } } }