#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
namespace ModCalculator {
int MOD;
inline void Inc(int &x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
inline void Dec(int &x, int y) {
  x -= y;
  if (x < 0) x += MOD;
}
inline int Add(int x, int y) {
  Inc(x, y);
  return x;
}
inline int Sub(int x, int y) {
  Dec(x, y);
  return x;
}
inline int Mul(int x, int y) { return 1LL * x * y % MOD; }
inline int ksm(int x, int k) {
  int ret = 1;
  for (; k; k >>= 1) {
    if (k & 1) ret = Mul(ret, x);
    x = Mul(x, x);
  }
  return ret;
}
inline int Inv(int x) { return ksm(x, MOD - 2); }
}  // namespace ModCalculator
using namespace ModCalculator;
int N, D;
int inv[MAXN], dp[MAXN][11][MAXN];
int DP(int n, int d, int k) {
  k = min(k, n - 1);
  if (n == 1) return (d == 0 || d == D - 1);
  if (!k) return 0;
  if (~dp[n][d][k]) return dp[n][d][k];
  int ret = DP(n, d, k - 1);
  int son = DP(k, D - 1, k), C = 1;
  for (int i = 1; i <= d && i * k < n; ++i) {
    C = Mul(C, Mul(son + i - 1, inv[i]));
    Inc(ret, Mul(C, DP(n - i * k, d - i, k - 1)));
  }
  return dp[n][d][k] = ret;
}
void solve() {
  read(N);
  read(D);
  read(MOD);
  if (N <= 2) {
    puts("1");
    return;
  }
  inv[0] = inv[1] = 1;
  for (int i = 2; i <= N; ++i) {
    inv[i] = Mul(MOD - MOD / i, inv[MOD % i]);
  }
  memset(dp, -1, sizeof(dp));
  int ans = DP(N, D, (N - 1) / 2);
  if (N % 2 == 0) {
    int half = DP(N / 2, D - 1, N / 2 - 1);
    Inc(ans, Mul(Mul(half, half + 1), inv[2]));
  }
  printf("%d\n", ans);
}
int main() {
  solve();
  return 0;
}
