#include <bits/stdc++.h> using namespace std; int main() { int n,m,P; cin >> n >> m >> P; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } while (m--) { int t,x,y; cin >> t >> x >> y; if (t == 1) { a[x-1] ^= y; } else { int p = 0; for (int i = x; i < y+1; i++) { int p1 = 0; if (i + P > n + 1) { continue; } for (int j = i; j < i+P; j++) { p1 ^= a[j-1]; } p += p1; } cout << p << endl; } } }