#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll st[300000];
int c[100005];
void update(int x, int xl, int xr, int p, int v){
if(xl==xr){
st[x]=v;
return;
}
int mid=(xl+xr)/2;
if(mid>=p) update(x*2+1,xl,mid,p,v);
else update(x*2+2,mid+1,xr,p,v);
st[x]=st[x*2+1]+st[x*2+2];
return;
}
ll sum(int x, int xl, int xr, int l, int r){
if(xl>=l && xr<=r) return st[x];
if(r<xl || l>xr) return 0;
int mid=(xl+xr)/2;
return sum(x*2+1,xl,mid,l,r)+sum(x*2+2,mid+1,xr,l,r);
}
void build(int x, int xl, int xr){
if(xl==xr){
st[x]=c[xl];
return;
}
int mid=(xl+xr)/2;
build(x*2+1,xl,mid);
build(x*2+2,mid+1,xr);
st[x]=st[x*2+1]+st[x*2+2];
return;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,q,k; cin>>n>>q>>k;
for(int i=1; i<=n; i++) cin>>c[i];
build(0,1,n);
for(int i=0; i<q; i++){
int s,t,u;
cin>>s>>t>>u;
if(s==1) update(0,1,n,t,u);
if(s==3) cout<<sum(0,1,n,t,u);
}
return 0;
}