#include <bits/stdc++.h>
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,popcnt")
using namespace std;
int n, d;
long long f[1010][15][1010], g[1010][15], ifac[15], mod;
template <class T>
void read(T &x) {
  char ch = x = 0;
  bool fl = false;
  while (!isdigit(ch)) fl |= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x = fl ? -x : x;
}
long long pw(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % mod;
    a = a * a % mod, b >>= 1;
  }
  return ret;
}
long long C(long long a, int b) {
  long long ret = ifac[b];
  for (int i = 1; i <= b; i++) ret = ret * (a - i + 1) % mod;
  return ret;
}
int main() {
  read(n), read(d), read(mod);
  if (n <= 2) return puts("1"), 0;
  ifac[0] = 1;
  for (int i = 1; i <= d; i++) ifac[i] = ifac[i - 1] * pw(i, mod - 2) % mod;
  for (int i = 0; i <= n; i++) f[1][0][i] = 1;
  for (int i = 1; i <= d; i++) g[1][i] = 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= d; j++) {
      for (int k = 1; k <= n; k++) {
        f[i][j][k] = f[i][j][k - 1];
        for (int l = 1; l <= min(j, i / k); l++)
          f[i][j][k] =
              (f[i][j][k] + f[i - l * k][j - l][k - 1] * g[k][l]) % mod;
      }
    }
    for (int j = 1; j <= d; j++) g[i][j] = C(f[i][d - 1][n] + j - 1, j);
  }
  long long ans = f[n][d][n / 2];
  if (~n & 1)
    ans =
        (ans - f[n / 2][d - 1][n / 2] * (f[n / 2][d - 1][n / 2] - 1) / 2 % mod +
         mod) %
        mod;
  printf("%lld\n", ans);
  return 0;
}
