#include <bits/stdc++.h>
using namespace std;
inline void rd(int &x) {
  char ch;
  x = 0;
  bool fl = false;
  while (!isdigit(ch = getchar())) (ch == '-') && (fl = true);
  for (x = (ch ^ '0'); isdigit(ch = getchar()); x = x * 10 + (ch ^ '0'))
    ;
  (fl == true) && (x = -x);
}
namespace Miracle {
const int N = 1005;
int mod, n, d;
int f[N][11][N];
int jie[11], inv[11];
int qm(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = (long long)ret * x % mod;
    x = (long long)x * x % mod;
    y >>= 1;
  }
  return ret;
}
int dp(int i, int j, int k) {
  if (f[i][j][k] != -1) return f[i][j][k];
  if (i == 1) {
    if (j == d - 1 || !j) return f[i][j][k] = 1;
    return f[i][j][k] = 0;
  }
  if (i == 0) {
    if (k == 0 && j == 0)
      return f[i][j][k] = 1;
    else
      return f[i][j][k] = 0;
  }
  if (j > i - 1) return f[i][j][k] = 0;
  if (i > 1 && k == 0) return f[i][j][k] = 0;
  int C = 1;
  int ret = 0;
  int tmp = dp(k, d - 1, k - 1);
  for (register int m = 0; m <= j && m * k <= i - 1; ++m) {
    ret = (ret +
           (long long)dp(i - m * k, j - m, k - 1) * C % mod * inv[m] % mod) %
          mod;
    C = (long long)C * (tmp - 1 + m + 1) % mod;
  }
  return f[i][j][k] = ret;
}
int main() {
  rd(n);
  rd(d);
  rd(mod);
  if (n <= 2) {
    puts("1");
    return 0;
  }
  memset(f, -1, sizeof f);
  jie[0] = 1;
  for (register int i = 1; i <= 10; ++i)
    jie[i] = (long long)jie[i - 1] * i % mod;
  inv[10] = qm(jie[10], mod - 2);
  for (register int i = 9; i >= 0; --i)
    inv[i] = (long long)inv[i + 1] * (i + 1) % mod;
  long long ans = 0;
  ans = (ans + dp(n, d, (n - 1) / 2));
  if (n % 2 == 0) {
    long long tmp = 0;
    tmp = dp(n / 2, d - 1, n / 2 - 1);
    ans = (ans + (tmp * (tmp + 1) / 2 % mod)) % mod;
  }
  printf("%I64d", ans);
  return 0;
}
}  // namespace Miracle
signed main() {
  Miracle::main();
  return 0;
}
