TLE求调
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAXX = 5e5+5;
int n,m;
int a[MAXX];
int opt,x,y,z;
int ans;
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>m;
for(int i = 1;i <= n;i++){cin>>a[i];}
while(m--)
{
cin>>opt;
if(opt==1)
{
cin>>x>>y>>z;
for(int i = x;i <= y;i++)
{a[i] += z;}
}
else
{
cin>>x;
cout<<a[x]<<endl;
}
}
return 0;
}