#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const int D = 15;
int dp[N];
int n, d, mod;
int dp2[2][N][D];
int fres = 1;
int fact[N], inv[N];
inline int fastpower(int num, int po) {
  fres = 1;
  while (po > 0) {
    if (po & 1) fres = (long long)fres * num % mod;
    po >>= 1;
    num = (long long)num * num % mod;
  }
  return fres;
}
int gret;
inline int get(int a, int k) {
  if (k == 0) return 1;
  gret = 1;
  for (int i = a + k - 1; i >= a; i--) gret = (long long)gret * i % mod;
  return (long long)gret * inv[k] % mod;
}
vector<int> good;
vector<vector<int> > val;
void solve(int i, int d) {
  for (int j = 0; j < i; j++)
    for (int e = 0; e <= d; e++) dp2[((int)good.size()) & 1][j][e] = 0;
  dp2[((int)good.size()) & 1][0][0] = 1;
  for (int Cur, Nxt, j = (int)good.size() - 1; j >= 0; j--) {
    Cur = (j & 1);
    Nxt = (Cur ^ 1);
    for (int s = 0; s < i; s++) {
      for (int e = 0; e <= d; e++) {
        dp2[Cur][s][e] = 0;
        for (int take = 0; good[j] * take <= s && take <= e; take++) {
          dp2[Cur][s][e] += (long long)val[j][take] *
                            dp2[Nxt][s - good[j] * take][e - take] % mod;
          if (dp2[Cur][s][e] >= mod) dp2[Cur][s][e] -= mod;
        }
      }
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &d, &mod);
  if (n == 1 || d == 2) {
    cout << 1 << endl;
    return 0;
  }
  fact[0] = 1;
  for (int i = 1; i < N; i++) {
    fact[i] = (long long)i * fact[i - 1] % mod;
    inv[i] = fastpower(fact[i], mod - 2);
  }
  dp[1] = 1;
  good.push_back(1);
  val.push_back(vector<int>(d + 1, 1));
  for (int i = 2; i <= n / 2; i++) {
    solve(i, d - 1);
    dp[i] = dp2[0][i - 1][d - 1];
    if (dp[i] > 0) {
      good.push_back(i);
      val.push_back(vector<int>(d + 1));
      for (int l = 0; l <= d; l++) {
        val.back()[l] = get(dp[i], l);
      }
    }
  }
  int ans = 0;
  if (n % 2 == 0) {
    ans += get(dp[n / 2], 2);
  }
  if (good.back() * 2 == n) good.pop_back();
  solve(n, d);
  ans += dp2[0][n - 1][d];
  if (ans >= mod) ans -= mod;
  cout << ans << endl;
  return 0;
}
