#include <bits/stdc++.h>
using namespace std;
int n, d, mo, inv[20], dp[1005][11][1005];
void ntr(int &x) { x = x >= mo ? x - mo : (x < 0 ? x + mo : x); }
void inc(int &x, int y) { x += y, ntr(x); }
long long qry(int x, int y) {
  if (y == 0) return 1;
  if (x == 0) return 0;
  x = x + y - 1;
  long long r = 1;
  for (int i = 1; i <= y; i++) r = r * (x - i + 1) % mo;
  return r * inv[y] % mo;
}
int ask(int n, int deg, int sz) {
  if (n == 1) return deg == 0 || deg == d - 1;
  if (sz == 0) return 0;
  int &ans = dp[n][deg][sz];
  if (ans != -1)
    return ans;
  else
    ans = 0;
  int tmp = ask(sz, d - 1, sz - 1);
  for (int p = 0, f = 1; p <= deg && sz * p <= n - 1; ++p) {
    inc(ans, ask(n - p * sz, deg - p, sz - 1) * qry(tmp, p) % mo);
  }
  return ans;
}
int main() {
  scanf("%d%d%d", &n, &d, &mo);
  if (n < 2) return puts("1"), 0;
  inv[1] = 1;
  for (int i = 2; i <= 15; i++) inv[i] = 1ll * (mo - mo / i) * inv[mo % i] % mo;
  inv[0] = 1;
  for (int i = 1; i <= 15; i++) inv[i] = 1ll * inv[i] * inv[i - 1] % mo;
  memset(dp, -1, sizeof(dp));
  int ans;
  if (n & 1)
    ans = ask(n, d, n / 2);
  else {
    ans = ask(n, d, n / 2 - 1);
    int tmp = ask(n / 2, d - 1, n / 2 - 1);
    inc(ans, qry(tmp, 2));
  }
  printf("%d\n", ans);
  return 0;
}
