#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ '0'), c = getchar();
  return x * f;
}
const int N = 1e3 + 5, M = 15;
int mod;
inline int inc(int x, int y) {
  x += y - mod;
  return x + (x >> 31 & mod);
}
inline int del(int x, int y) {
  x -= y;
  return x + (x >> 31 & mod);
}
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline void Inc(int &x, int y) { x = inc(x, y); }
inline void Del(int &x, int y) { x = del(x, y); }
inline void Mul(int &x, int y) { x = mul(x, y); }
inline long long Pow(long long x, int k) {
  long long res = 1;
  while (k) {
    if (k & 1) res = res * x % mod;
    k >>= 1;
    x = x * x % mod;
  }
  return res;
}
bool st;
int fac[M], inv[M];
inline void init(int n) {
  fac[0] = inv[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
  inv[n] = Pow(fac[n], mod - 2);
  for (int i = n - 1; i >= 1; i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % mod;
}
int n, d, f[N][M][N];
inline int C(int n, int m) {
  if (n < m) return 0;
  long long res = 1;
  for (int i = n; i >= n - m + 1; i--) res = res * i % mod;
  return res * inv[m] % mod;
}
bool ed;
int main() {
  n = read(), d = read(), mod = read();
  if (n <= 2) return puts("1"), 0;
  init(10);
  for (int i = 0; i <= n; i++) f[1][0][i] = 1;
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= min(i - 1, d); j++)
      for (int k = 1; k <= n; k++) {
        f[i][j][k] = f[i][j][k - 1];
        for (int t = 1; t <= j && i - t * k > 0; t++)
          if (k ^ 1)
            Inc(f[i][j][k], mul(f[i - t * k][j - t][k - 1],
                                C(f[k][d - 1][k - 1] + t - 1, t)));
          else
            Inc(f[i][j][k],
                mul(f[i - t * k][j - t][k - 1], C(f[k][0][k - 1] + t - 1, t)));
      }
  int ans = 0;
  if (n & 1)
    ans = f[n][d][n / 2];
  else
    ans = del(f[n][d][n / 2], C(f[n / 2][d - 1][n / 2 - 1], 2));
  printf("%d\n", ans);
  return 0;
}
