#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et() {
  puts("-1");
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 1000000007) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
int inv[250125], fac[250125];
int P, dp[30][250125], M = 19;
int bcnt[250125];
void fmain(int tid) {
  scanf("%d%d%d", &n, &k, &P);
  inv[0] = 1;
  fac[0] = 1;
  int ans = 1;
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    fac[i] = (long long)fac[i - 1] * i % P;
    inv[i] = fastPow(fac[i], P - 2, P);
    bcnt[i] = __builtin_popcount(i);
    ans = (long long)ans * k % P;
  }
  if (n % 2 == 0) {
    dp[0][0] = 1;
    for (int i = 0; i < min(bcnt[n], k); i++) {
      for (int(j) = 0; (j) < (int)(n); (j)++) {
        if (dp[i][j] == 0) continue;
        int x = n ^ j;
        for (int z = x, r; z > j; z = (z - 1) & x) {
          r = z | j;
          addmod(dp[i + 1][r], (long long)dp[i][j] * inv[z] % P, P);
        }
      }
    }
    for (int(i) = 1; (i) <= (int)(k); (i)++)
      addmod(ans,
             P - (long long)dp[i][n] * fac[n] % P * fac[k] % P * inv[k - i] % P,
             P);
  }
  printf("%d\n", ans);
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
