#include <bits/stdc++.h>
using namespace std;
long long n, d, mod, f[1100][11], jc[11];
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - 48;
    ch = getchar();
  }
  return x * f;
}
inline long long ksm(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans % mod;
}
int main() {
  n = read();
  d = read();
  mod = read();
  if (n <= 2) {
    cout << 1;
    return 0;
  }
  f[1][d - 1] = f[1][0] = jc[1] = 1;
  for (int i = 2; i <= d; i++) jc[i] = jc[i - 1] * i;
  for (int i = 2; i <= d; i++) jc[i] = ksm(jc[i], mod - 2);
  for (int k = 1; k <= n / 2; k++) {
    if (!f[k][d - 1]) continue;
    long long tmp = f[k][d - 1], cs = 0;
    for (int i = n; i >= k + 1; i--) {
      for (int j = 1; j <= d; j++) {
        tmp = f[k][d - 1];
        cs = 0;
        for (int t = 1; t <= j && t * k <= i; t++) {
          if (t != 1) tmp *= (++cs + f[k][d - 1]), tmp %= mod;
          f[i][j] += (f[i - k * t][j - t] * tmp % mod) * jc[t] % mod;
          f[i][j] %= mod;
        }
      }
    }
  }
  if (n % 2)
    cout << f[n][d] % mod;
  else {
    f[n][d] -= f[n / 2][d - 1] * (f[n / 2][d - 1] - 1) % mod * jc[2] % mod;
    cout << (f[n][d] + mod) % mod;
  }
}
