#include <bits/stdc++.h>
using namespace std;
unsigned long long mod, dp[18][250005];
unsigned long long fac[250005], inv[250005];
unsigned long long n, k;
inline unsigned long long qpow(unsigned long long a, unsigned long long b) {
  unsigned long long res = 1ll, tp = a;
  while (b) {
    if (b & 1ll) {
      res *= tp;
      res %= mod;
    }
    tp *= tp;
    tp %= mod;
    b >>= 1ll;
  }
  return res;
}
inline unsigned long long cal(int a, int b) {
  return (((fac[a] * inv[b]) % mod) * inv[a - b]) % mod;
}
inline unsigned long long calc() {
  int i, j, l;
  fac[0] = 1ll;
  for (i = 1; i <= n; i++)
    fac[i] = fac[i - 1] * ((unsigned long long)(i)) % mod;
  inv[n] = qpow(fac[n], mod - 2ll);
  for (i = n - 1; i >= 0; i--)
    inv[i] = inv[i + 1] * ((unsigned long long)(i + 1)) % mod;
  for (i = 1; i <= n; i++) {
    dp[1][i] = inv[i];
  }
  unsigned long long ans = dp[1][n] * cal(k, 1) % mod;
  int t = min(17, ((int)(k)));
  for (i = 2; i <= t; i++) {
    for (j = 1; j <= n; j++) {
      if ((j & n) != j) {
        continue;
      }
      int cnt = 0;
      for (l = j; l; l = (l - 1) & j) {
        dp[i][j] += dp[i - 1][j ^ l] * inv[l];
        cnt++;
        if (cnt == 18) {
          cnt = 0;
          dp[i][j] %= mod;
        }
      }
      dp[i][j] %= mod;
    }
    ans += dp[i][n] * cal(k, i);
    ans %= mod;
  }
  ans *= fac[n];
  ans %= mod;
  return ans;
}
int main() {
  cin >> n >> k >> mod;
  unsigned long long ans = qpow(k, n);
  if (n & 1) {
    cout << ans << endl;
    return 0;
  }
  ans = (ans - calc() + mod) % mod;
  cout << ans << endl;
  return 0;
}
