#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
using namespace std;
namespace ywy {
int p;
unsigned char bv[1001][1001][11];
long long f[1001][1001][11];
int d;
inline long long mi(int a, int b) {
  long long ans = 1, tmp = a;
  while (b) {
    if (b & 1) ans = (ans * tmp) % p;
    tmp = (tmp * tmp) % p;
    b >>= 1;
  }
  return (ans);
}
long long ny[1001];
long long dp(int sz, int mx, int dk) {
  if (bv[sz][mx][dk]) return (f[sz][mx][dk]);
  bv[sz][mx][dk] = 1;
  if (sz == 1) {
    return (f[sz][mx][dk] = (dk == 0));
  }
  if (!dk || !mx || dk >= sz) return (f[sz][mx][dk] = 0);
  if (mx == 1) {
    return (f[sz][mx][dk] = (sz == dk + 1));
  }
  long long ans = dp(sz, mx - 1, dk);
  long long h = dp(mx, mx, d - 1);
  if (!h) return (f[sz][mx][dk] = ans);
  long long ji = 1;
  for (register int i = 1; i <= dk && i * mx < sz; i++) {
    ji *= ny[i];
    ji %= p;
    ji *= (h + i - 1);
    ji %= p;
    ans = (ans + dp(sz - i * mx, mx - 1, dk - i) * ji) % p;
  }
  return (f[sz][mx][dk] = ans);
}
void ywymain() {
  int n;
  cin >> n >> d >> p;
  for (register int i = 1; i <= d; i++) ny[i] = mi(i, p - 2);
  if (n <= 2) {
    cout << 1 << endl;
    return;
  }
  if (n & 1) {
    cout << dp(n, n / 2, d) << endl;
    return;
  }
  long long cjr = dp(n / 2, n / 2 - 1, d - 1);
  cjr = ((cjr + 1) * cjr) / 2;
  cjr %= p;
  cjr %= p;
  cjr += dp(n, n / 2 - 1, d);
  cjr %= p;
  cout << cjr << endl;
}
}  // namespace ywy
signed main() {
  ywy::ywymain();
  return (0);
}
