#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void readi(T &x) {
  char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  x = c ^ '0';
  while (c = getchar(), c >= '0' && c <= '9') x = x * 10 + (c ^ '0');
}
const int M = 1051131, d2 = 525566;
int n, m, s, ans, a[1 << 25];
long long T;
int pow(int a, long long b) {
  int s = 1;
  for (; b; b >>= 1, a = (long long)a * a % M)
    if (b & 1) s = (long long)s * a % M;
  return s;
}
void solve(int n, int p, int q) {
  if (n == 1) {
    *a = (long long)*a * pow(p + q, T) % M;
    return;
  }
  int w = n >> 1, t = pow((p + q - (long long)w * p % M + M) % M, T);
  for (register int x, y, *i = a, *j = a + w; i < a + w; i++, j++)
    x = *i, y = *j, *i = (x + y) % M, *j = (x - y + M) % M;
  solve(w, (p + p) % M, ((long long)w * p - p + q + M) % M);
  for (register int x, y, *i = a, *j = a + w; i < a + w; i++, j++)
    x = *i, y = (long long)*j * t % M, *i = (long long)(x + y) * d2 % M,
    *j = (long long)(x - y + M) * d2 % M;
}
int main() {
  readi(m), readi(T), readi(s);
  for (int i = 0; i < s; i++) readi(a[i]);
  n = 1 << m;
  for (int i = s; i < n; i++) a[i] = ((long long)a[i - s] * 101 + 10007) % M;
  solve(n, 1, 0);
  for (int i = 0; i < n; i++) ans ^= a[i];
  printf("%d\n", ans);
  return 0;
}
