#include <bits/stdc++.h>
using namespace std;
bool home = 1;
signed realMain();
signed main() {
  home = 0;
  if (home) {
    freopen("tony_stark", "r", stdin);
  } else {
    ios::sync_with_stdio(0);
    cin.tie(0);
  }
  realMain();
}
long long mod;
long long add(long long a, long long b) {
  a += b;
  if (a >= mod) return a - mod;
  if (a < 0) return a + mod;
  return a;
}
long long mul(long long a, long long b) { return a * (long long)b % mod; }
long long pw(long long a, long long b) {
  long long r = 1;
  while (b) {
    if (b & 1) r = mul(r, a);
    a = mul(a, a);
    b /= 2;
  }
  return r;
}
long long dv(long long a, long long b) { return mul(a, pw(b, mod - 2)); }
void baga(long long &a, long long x) { a = add(a, x); }
const long long N = 1234 + 7;
const long long D = 10 + 7;
long long fact[N], ifact[N], dp[N][D][N];
long long comb(long long n, long long k) {
  assert(k < D);
  long long ret = ifact[k];
  for (long long i = n - k + 1; i <= n; i++) ret = mul(ret, i);
  return ret;
}
signed realMain() {
  long long n, wanda;
  cin >> n >> wanda >> mod;
  if (n <= 2) {
    cout << "1\n";
    return 0;
  }
  fact[0] = 1;
  for (long long i = 1; i < N; i++) fact[i] = mul(fact[i - 1], i);
  ifact[N - 1] = dv(1, fact[N - 1]);
  for (long long i = N - 2; i >= 0; i--) ifact[i] = mul(ifact[i + 1], i + 1);
  { dp[1][0][0] = dp[1][wanda - 1][0] = 1; }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= wanda; j++) {
      for (long long k = 1; k <= n; k++) {
        baga(dp[i][j][k], dp[i][j][k - 1]);
        for (long long t = 1; t <= j && t * k <= i; t++) {
          baga(dp[i][j][k], mul(dp[i - t * k][j - t][k - 1],
                                comb(dp[k][wanda - 1][k - 1] + t - 1, t)));
        }
      }
    }
  }
  long long ret = dp[n][wanda][(n - 1) / 2];
  if (n % 2 == 0) {
    ret = add(ret, comb(dp[n / 2][wanda - 1][n / 2 - 1] + 1, 2));
  }
  cout << ret << "\n";
  return 0;
}
