#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n,m,p,y,x,l,r,choice,res=0; cin>>n>>m>>p; p--; vector<ll>vec(n); ll sum=0; for(int j=0;j<n;j++) { cin>>vec[j]; } while(m--) { cin>>choice; if(choice==1) { cin>>y>>x; vec[y-1]=vec[y-1]^x; } else { cin>>l>>r; for(int i=l-1;i<r;i++) { res=vec[i]; if(i+p<n){ for(int j=i+1;j<=i+p;j++) { res=res^vec[j]; }} else res=0; sum+=res; } cout<<sum<<endl; sum=0; } } }