import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Solution2 {

    // Complete the xorQueries function below.
    static long[] xorQueries(int[] a, int m, int p) {
        // Return an array consisting of the answers of all type-2 queries.
        ArrayList<Long> results = new ArrayList<>(m);
        int[] P = new int[a.length];

        int pTemp = 0;
        int maxP = a.length - p;
        for (int i = a.length - 1; i >= 0; --i) {
            pTemp ^= a[i];
            if (i + p <= a.length) {
                P[i] = pTemp;
                pTemp ^= a[i + p - 1];
            }
        }

        for (int i = 0; i < m; ++i) {
            String[] lines = scanner.nextLine().split(" ");
            int command = Integer.parseInt(lines[0]);
            int x1 = Integer.parseInt(lines[1]);
            int x2 = Integer.parseInt(lines[2]);

            if (command == 1) {
                x1--;
                a[x1] ^= x2;
                for (int j = Math.min(maxP, x1); j > x1 - p; --j) {
                    if (j < 0) {
                        break;
                    }

                    P[j] ^= x2;
                }
            } else {
                x1--;
                x2--;

                long result = 0;
                int end = Math.min(maxP, x2);
                for (int j = x1; j <= end; ++j) {
                    result += P[j];
                    //result += P(a, j, p);
                }

                results.add(result);
            }
        }

        return  results.stream().mapToLong(x -> x).toArray();
    }

    private static int P(int[] a, int j, int p) {
        if (j + p > a.length) {
            return 0;
        }

        int result = 0;
        for (int i = 0; i < p; ++i) {
            result ^= a[i + j];
        }

        return result;
    }

    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) throws IOException {
        //BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));

        String[] nmp = scanner.nextLine().split(" ");

        int n = Integer.parseInt(nmp[0]);

        int m = Integer.parseInt(nmp[1]);

        int p = Integer.parseInt(nmp[2]);

        int[] a = new int[n];

        String[] aItems = scanner.nextLine().split(" ");
        scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");

        for (int i = 0; i < n; i++) {
            int aItem = Integer.parseInt(aItems[i]);
            a[i] = aItem;
        }

        long[] result = xorQueries(a, m, p);

        for (int i = 0; i < result.length; i++) {
            System.out.println(result[i]);
        }

        scanner.close();
    }
}