#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long double eps = 1e-7;
const int inf = 1000000010;
const long long INF = 10000000000000010LL;
const int MAXN = 1110, LOG = 20;
long long n, m, k, d, x, y, t, a, b, mod;
long long dp[MAXN][MAXN][11];
long long F[MAXN];
long long I[MAXN];
long long inv[MAXN];
long long powmod(long long a, long long b) {
  if (!b) return 1;
  if (b & 1) return a * powmod(a * a % mod, b >> 1) % mod;
  return powmod(a * a % mod, b >> 1);
}
long long C(long long n, long long r) {
  if (r > n || r < 0) return 0;
  if (n < MAXN) return (F[n] * I[r] % mod) * I[n - r] % mod;
  long long res = 1;
  r = min(r, n - r);
  for (int i = 1; i <= r; i++) res = res * ((n - i + 1) * inv[i] % mod) % mod;
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> d >> mod;
  if (n <= 2 || d == 2) return cout << 1 << '\n', 0;
  F[0] = inv[0] = 1;
  for (int i = 1; i < MAXN; i++) F[i] = F[i - 1] * i % mod;
  I[MAXN - 1] = powmod(F[MAXN - 1], mod - 2);
  for (int i = MAXN - 1; i; i--) I[i - 1] = I[i] * i % mod;
  for (int i = 1; i < MAXN - 1; i++) inv[i] = I[i] * F[i - 1] % mod;
  for (int i = 0; i <= n; i++) dp[0][i][0] = dp[1][i][0] = dp[1][i][d - 1] = 1;
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= n; j++)
      for (int k = 1; k <= d; k++) {
        dp[i][j][k] = dp[i][j - 1][k];
        for (int t = 1; t <= k; t++)
          if (i - t * j > 0)
            dp[i][j][k] += dp[i - t * j][j - 1][k - t] *
                           C(dp[j][n / 2][d - 1] + t - 1, t) % mod;
        dp[i][j][k] %= mod;
      }
  long long ans = dp[n][n / 2 - 1][d];
  if (n % 2 == 0) ans = (ans + C(dp[n / 2][n / 2][d - 1] + 1, 2)) % mod;
  cout << ans << '\n';
  return 0;
}
