#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using db = double;
int n, k, mod;
int f[250006][27];
const int N = 250001;
int fac[N], inv[N], ifac[N];
bool v[250006];
int main() {
  cin >> n >> k >> mod;
  inv[1] = fac[0] = fac[1] = ifac[0] = ifac[1] = 1;
  for (int i = 2; i < N; ++i) {
    inv[i] = (ll)mod / i * (mod - inv[mod % i]) % mod;
    fac[i] = (ll)fac[i - 1] * i % mod;
    ifac[i] = (ll)ifac[i - 1] * inv[i] % mod;
  }
  ll ans = 1;
  for (int i = 1; i <= n; ++i) (ans *= k) %= mod;
  if (n % 2 == 0) {
    v[n] = true;
    for (int i = n; i >= 1; --i)
      if (v[i])
        for (int msk = i - ((i) & -(i)), j = msk;; --j &= msk) {
          v[j] = true;
          if (!j) break;
        }
    f[0][0] = 1;
    for (int i = 1; i <= n; ++i)
      if (v[i])
        for (int msk = i - ((i) & -(i)), j = msk;; --j &= msk) {
          int len = min(k - 1, __builtin_popcount(j));
          for (int t = 0; t <= len; ++t)
            f[i][t + 1] = (f[i][t + 1] + (ll)f[j][t] * ifac[i - j]) % mod;
          if (!j) break;
        }
    for (int i = 1; i <= k; ++i)
      (ans -= (ll)f[n][i] * fac[n] % mod * fac[k] % mod * ifac[k - i]) %= mod;
  }
  cout << (ans + mod) % mod << endl;
  return 0;
}
