#include <bits/stdc++.h>
using namespace std;
const int N = (1 << 17) + 5;
int inv[N * 2], fac[N * 2];
int n, K, mod, cnt[N];
int f[18][N], g[18][N];
unsigned long long h[18][N];
int power(int x, int y) {
  int s = 1;
  for (; y; y /= 2, x = 1ll * x * x % mod)
    if (y & 1) s = 1ll * s * x % mod;
  return s;
}
void init() {
  inv[0] = inv[1] = fac[0] = 1;
  for (int i = (int)(2); i <= (int)(2 * N - 1); i++)
    inv[i] = 1ll * inv[mod % i] * (mod - mod / i) % mod;
  for (int i = (int)(1); i <= (int)(2 * N - 1); i++)
    inv[i] = 1ll * inv[i - 1] * inv[i] % mod;
  for (int i = (int)(1); i <= (int)(2 * N - 1); i++)
    fac[i] = 1ll * fac[i - 1] * i % mod;
  for (int i = (int)(0); i <= (int)(N - 1); i++) cnt[i] = cnt[i / 2] + (i & 1);
}
void DFT(int *a, int n) {
  for (int d = 1; d < n; d <<= 1)
    for (int i = 0; i < n; i += d << 1)
      for (int j = 0; j < d; j++)
        a[i + j + d] = (a[i + j + d] + a[i + j]) % mod;
}
void IDFT(int *a, int n) {
  for (int d = 1; d < n; d <<= 1)
    for (int i = 0; i < n; i += d << 1)
      for (int j = 0; j < d; j++)
        a[i + j + d] = (a[i + j + d] + mod - a[i + j]) % mod;
}
int main() {
  scanf("%d%d%d", &n, &K, &mod);
  int ans = power(K, n);
  if (n & 1) {
    printf("%d\n", ans);
    exit(0);
  }
  init();
  for (int i = (int)(0); i <= (int)(n / 2); i++) f[cnt[i]][i] = inv[i * 2];
  int lim = cnt[n / 2];
  for (int i = (int)(0); i <= (int)(lim); i++) DFT(f[i], 1 << 17);
  for (int i = (int)(0); i <= (int)(lim); i++)
    for (int j = (int)(0); j <= (int)((1 << 17) - 1); j++) g[i][j] = f[i][j];
  for (int i = (int)(2); i <= (int)(K); i++) {
    memset(h, 0, sizeof(h));
    for (int j = (int)(0); j <= (int)(lim); j++)
      for (int k = (int)(0); k <= (int)(lim - j); k++)
        for (int l = (int)(0); l <= (int)((1 << 17) - 1); l++)
          h[j + k][l] += 1ll * g[j][l] * f[k][l];
    for (int j = (int)(0); j <= (int)(lim); j++)
      for (int l = (int)(0); l <= (int)((1 << 17) + 1); l++)
        g[j][l] = h[j][l] % mod;
  }
  IDFT(g[cnt[n / 2]], 1 << 17);
  ans = (ans + mod - 1ll * fac[n] * g[cnt[n / 2]][n / 2] % mod) % mod;
  printf("%d\n", ans);
}
