#include <bits/stdc++.h>
using namespace std;
const int mod = 1051131;
const int Inv2 = (mod + 1) >> 1;
inline void setIO(string a) {}
long long Power;
int m, s, n, nn;
int a[(1 << 25) + 23];
void work(int n, int p, int q) {
  if (n == 1) {
    int &An = a[1];
    (p += q) %= mod;
    for (long long c = Power; c; c >>= 1, p = 1ll * p * p % mod)
      if (c & 1) An = 1ll * An * p % mod;
    return;
  }
  int t = n >> 1, tt = 1ll * t * p % mod;
  int ttp = (p + q + mod - tt) % mod, tttp = 1;
  for (long long c = Power; c; c >>= 1, ttp = 1ll * ttp * ttp % mod)
    if (c & 1) tttp = 1ll * tttp * ttp % mod;
  int xi = (1ll * t * p % mod - p + q + mod) % mod;
  for (int i = (1); i <= (t); i++) {
    int A = a[i], B = a[i + t];
    a[i] = (A + B) % mod;
    a[i + t] = (A + mod - B) % mod;
    a[i + t] = 1ll * a[i + t] * tttp % mod;
  }
  work(n >> 1, (p + p) % mod, xi);
  for (int i = (1); i <= (t); i++) {
    int A = a[i], B = a[i + t];
    a[i] = (A + B) % mod;
    a[i + t] = (A + mod - B) % mod;
    a[i] = 1ll * a[i] * Inv2 % mod;
    a[i + t] = 1ll * a[i + t] * Inv2 % mod;
  }
}
int main() {
  scanf("%d", &m);
  cin >> Power;
  scanf("%d", &s);
  for (int i = (1); i <= (s); i++) scanf("%d", &a[i]);
  n = 1 << m;
  nn = n;
  for (int i = (s + 1); i <= (n); i++)
    a[i] = (101ll * a[i - s] + 10007) % 1051131;
  work(n, 1, 0);
  int ans = 0;
  for (int i = (1); i <= (n); i++) ans ^= a[i];
  printf("%d\n", ans);
  return 0;
}
