#include <bits/stdc++.h>
using namespace std;
int mod = 1000000000 + 7;
int addm(int& a, int b) {
  return (a += b) < mod ? (a < 0 ? a += mod : a) : a -= mod;
}
int addm2(int a, int b) { return addm(a, b); }
template <class T, class U>
bool smin(T& a, U b) {
  return a > b ? (a = b, 1) : 0;
}
template <class T, class U>
bool smax(T& a, U b) {
  return a < b ? (a = b, 1) : 0;
}
int n, d, dp[1001][11][1001], cs[1001][11][1002];
int a, b, g;
void gcd(int m, int n) {
  if (n == 0) {
    a = 1;
    b = 0;
    g = m;
    return;
  }
  gcd(n, m % n);
  int t = a - b * (m / n);
  a = b;
  b = t;
}
int inv(int a, int mod) {
  gcd(mod, a);
  return g > 0 ? b : -b;
}
int iv[1001];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> d >> mod;
  dp[0][0][0] = 1;
  for (int i = 1; i <= 1000; i++) iv[i] = inv(i, mod);
  for (int i = 1; i < 1002; i++)
    for (int j = 0; j <= d; j++)
      cs[0][j][i] = addm2(cs[0][j][i - 1], dp[0][j][i - 1]);
  for (int i = 1; i < n; i++)
    for (int j = 1; j <= d; j++)
      for (int k = 1; k < n; k++) {
        long long f = 1;
        for (int l = 1; l * k <= i && l <= j && (k == 1 || cs[k - 1][d - 1][k]);
             l++) {
          f = f * ((k == 1 ? 1 : cs[k - 1][d - 1][k]) + l - 1) % mod * iv[l] %
              mod;
          addm(cs[i][j][k + 1], (long long)cs[i - l * k][j - l][k] * f % mod);
        }
        addm(cs[i][j][k + 1], cs[i][j][k]);
      }
  int ans = cs[n - 1][d][(n + 1) / 2];
  addm(ans, cs[n - 1][0][(n + 1) / 2]);
  if (n % 2 == 0) {
    long long v = cs[n / 2 - 1][d - 1][n / 2] + cs[n / 2 - 1][0][n / 2];
    addm(ans, v * (v + 1) / 2 % mod);
  }
  if (ans < 0) ans += mod;
  cout << ans << endl;
}
