#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
mt19937 ggen;
int MOD;
inline int add(int a, int b, int m = MOD) {
  int res = a + b;
  if (res >= m) res -= m;
  return res;
}
inline int sub(int a, int b, int m = MOD) {
  int res = a - b;
  if (res < 0) res += m;
  return res;
}
inline int mul(int a, int b, int m = MOD) { return ((long long)(a)*b) % m; }
inline int binpow(int a, int p, int m = MOD) {
  if (m == 1) return 0;
  int res = 1;
  while (p) {
    if (p & 1) res = mul(res, a, m);
    a = mul(a, a, m);
    p >>= 1;
  }
  return res;
}
inline int obr(int a, int m = MOD) { return binpow(a, m - 2, m); }
int fact[1010];
int rfact[1010];
void precalc() {
  fact[0] = rfact[0] = 1;
  for (int i = 1; i < 1010; i++) {
    fact[i] = mul(fact[i - 1], i);
    rfact[i] = obr(fact[i]);
  }
}
inline int comb(int n, int k) {
  int res = rfact[k];
  for (int i = 0; i < k; i++) {
    res = mul(res, n);
    n--;
  }
  return res;
}
int n, d;
int f[1010][11][1010];
int dyn(int sz, int pw, int ms) {
  if (pw == 0) {
    return sz == 1;
  }
  if (ms == 0) return 0;
  if (ms == 1) return (sz - 1 == pw);
  if (f[sz][pw][ms] != -1) return f[sz][pw][ms];
  int res = dyn(sz, pw, ms - 1);
  int tt = dyn(ms, d - 1, ms - 1);
  for (int i = 1; i <= pw && sz > i * ms && tt; i++) {
    int tres = dyn(sz - i * ms, pw - i, ms - 1);
    res = add(res, mul(tres, comb(tt + i - 1, i)));
  }
  return f[sz][pw][ms] = res;
}
void solve() {
  cin >> n >> d >> MOD;
  precalc();
  if (n <= 2) {
    cout << 1;
    return;
  }
  memset(f, -1, sizeof f);
  int res = dyn(n, d, (n - 1) / 2);
  if ((n & 1) == 0) {
    res = add(res, comb(dyn(n / 2, d - 1, n / 2 - 1) + 1, 2));
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ggen = mt19937(13);
  solve();
  return 0;
}
