/* Put your heart, mind and soul into even your smallest acts. this is the secret of success. */ #include<bits/stdc++.h> using namespace std; typedef long long int ll; #define DHOKHA ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) int main(){ DHOKHA; ll n,m,p; cin>>n>>m>>p; ll a[n]; ll i,j; for(i=0;i<=n-1;i++){ cin>>a[i]; } while(m--){ ll type; cin>>type; if(type==1){ ll l,r; cin>>l>>r; l-=1; a[l]=(a[l]^r); }else{ ll l,r; cin>>l>>r; l-=1; r-=1; ll ans=0; for(i=l;i<=r;i++){ ll ans1=0; if(i+p-1<n){ for(j=i;j<=i+p-1;j++){ ans1^=a[j]; } } ans+=ans1; } cout<<ans<<"\n"; } } }