#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int P;
template <typename T1, typename T2>
void Inc(T1 &a, T2 b) {
  a += b;
  if (a >= P) a -= P;
}
template <typename T1, typename T2>
void Dec(T1 &a, T2 b) {
  a -= b;
  if (a < 0) a += P;
}
template <typename T1, typename T2>
T1 Add(T1 a, T2 b) {
  a += b;
  return a >= P ? a - P : a;
}
template <typename T1, typename T2>
T1 Sub(T1 a, T2 b) {
  a -= b;
  return a < 0 ? a + P : a;
}
long long ksm(long long a, long long b) {
  long long ret = 1;
  for (; b; b >>= 1, (a *= a) %= P)
    if (b & 1) (ret *= a) %= P;
  return ret;
}
int n, d;
long long f[MAXN][11][MAXN], inv[MAXN];
long long C2(long long x) { return x * (x - 1) / 2 % P; }
int main() {
  scanf("%d%d%d", &n, &d, &P);
  if (n <= 2) return puts("1"), 0;
  for (int i = 0; i <= n; i++) f[1][0][i] = 1;
  inv[1] = 1;
  for (int i = 2; i <= d; i++) inv[i] = Sub(P, P / i) * inv[P % i] % P;
  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];
        long long s = f[k][d - 1][k], C = 1;
        if (k == 1) s = 1;
        for (int m = 1; m * k <= i && m <= j; m++) {
          C = C * (s + m - 1) % P * inv[m] % P;
          Inc(f[i][j][k], f[i - m * k][j - m][k - 1] * C % P);
        }
      }
  long long Ans = f[n][d][n / 2];
  if (~n & 1) Dec(Ans, C2(f[n / 2][d - 1][n / 2]));
  printf("%lld\n", Ans);
}
