#include <bits/stdc++.h>
using namespace std;
long long read() {
  char c = getchar();
  long long flag = 1, ans = 0;
  while (c < '0' || c > '9') {
    if (c == '-') flag = -flag;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ans = ans * 10 + c - '0';
    c = getchar();
  }
  return ans * flag;
}
const long long MAXN = 1005;
long long dp[MAXN][12][MAXN], inv[MAXN], fac[MAXN];
long long n, d, mod;
inline long long add(long long a, long long b) {
  return (a + b >= mod) ? (a + b - mod) : (a + b);
}
inline long long sub(long long a, long long b) {
  return (a < b) ? (a + mod - b) : (a - b);
}
inline long long mul(long long a, long long b) { return a * b % mod; }
long long qpow(long long b, long long k) {
  long long ans = 1;
  while (k) {
    if (k & 1) ans = mul(ans, b);
    b = mul(b, b);
    k >>= 1;
  }
  return ans;
}
void init() {
  fac[0] = 1;
  for (long long i = 1; i <= n; ++i) fac[i] = mul(fac[i - 1], i);
  inv[n] = qpow(fac[n], mod - 2);
  for (long long i = n - 1; i + 1; --i) inv[i] = mul(inv[i + 1], i + 1);
}
long long C(long long n, long long m) {
  if (n < 0 || m < 0 || n < m) return 0;
  long long ans = 1;
  for (long long i = 0; i < m; ++i) ans = mul(ans, (n - i));
  return mul(ans, inv[m]);
}
int main() {
  n = read(), d = read(), mod = read();
  if (n <= 2) {
    puts("1");
    return 0;
  }
  init();
  for (long long i = 0; i <= n; ++i) dp[1][0][i] = 1ll;
  for (long long i = 2; i <= n; ++i)
    for (long long j = 1; j <= min(d, i - 1); ++j)
      for (long long k = 1; k <= n; ++k) {
        dp[i][j][k] = dp[i][j][k - 1];
        for (long long t = 1; t <= j && t * k <= i; ++t)
          dp[i][j][k] =
              add(dp[i][j][k],
                  mul(C(dp[k][(k > 1) ? (d - 1) : 0][k - 1] + t - 1, t),
                      dp[i - t * k][j - t][k - 1]));
      }
  long long ans = dp[n][d][n / 2];
  if (!(n & 1)) ans = sub(ans, C(dp[n / 2][d - 1][n / 2 - 1], 2));
  printf("%lld\n", ans);
  return 0;
}
