#include <bits/stdc++.h>
using namespace std;
template <class T>
bool cmax(T &x, T y) {
  return y > x ? x = y, 1 : 0;
}
template <class T>
bool cmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
const int N = 1005, M = 15;
int n, m, mod, f[N][M][N], ifac[M], fac[M];
int kpow(int a, int k) {
  int res = 1;
  for (; k; k >>= 1, a = 1ll * a * a % mod)
    if (k & 1) res = 1ll * res * a % mod;
  return res;
}
int C(int n, int m) {
  int res = 1;
  for (int i = 0; i < m; ++i) res = 1ll * res * (n - i) % mod;
  return 1ll * res * ifac[m] % mod;
}
int F(int n, int d, int mx) {
  if (!d || !mx || n == 1) return n == 1 && !d;
  if (~f[n][d][mx]) return f[n][d][mx];
  f[n][d][mx] = F(n, d, mx - 1);
  for (int i = 1; i <= min(n - 1, d) && i * mx < n; ++i)
    (f[n][d][mx] += 1ll * F(n - i * mx, d - i, mx - 1) *
                    C((mx == 1 ? 1 : F(mx, m - 1, mx)) + i - 1, i) % mod) %=
        mod;
  return f[n][d][mx];
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> mod;
  if (n <= 2) {
    cout << 1 << endl;
    return 0;
  }
  fac[0] = 1;
  for (int i = 1; i <= m; ++i) fac[i] = 1ll * i * fac[i - 1] % mod;
  ifac[m] = kpow(fac[m], mod - 2);
  for (int i = m - 1; i >= 0; --i) ifac[i] = 1ll * ifac[i + 1] * (i + 1) % mod;
  memset(f, -1, sizeof f);
  if (n & 1)
    cout << F(n, m, n / 2) << endl;
  else {
    cout << (F(n, m, n / 2) + mod - C(F(n / 2, m - 1, n / 2 - 1), 2)) % mod
         << endl;
  }
  return 0;
}
