#include <bits/stdc++.h>
namespace my_std {
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
inline T rnd(T l, T r) {
  return uniform_int_distribution<T>(l, r)(rng);
}
template <typename T>
inline void read(T& t) {
  t = 0;
  char f = 0, ch = getchar();
  double d = 0.1;
  while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
  while (ch <= '9' && ch >= '0') t = t * 10 + ch - 48, ch = getchar();
  if (ch == '.') {
    ch = getchar();
    while (ch <= '9' && ch >= '0') t += d * (ch ^ 48), d *= 0.1, ch = getchar();
  }
  t = (f ? -t : t);
}
template <typename T, typename... Args>
inline void read(T& t, Args&... args) {
  read(t);
  read(args...);
}
void file() {}
}  // namespace my_std
using namespace my_std;
int n, d;
long long mod;
long long dp[1010][15][1010];
long long inv[15];
long long dfs(int i, int j, int k) {
  k = min(k, n - 1);
  if (dp[i][j][k] != -1) return dp[i][j][k];
  if (i == 1) return j == 0 || j == d - 1;
  if (!k) return 0;
  long long ret = dfs(i, j, k - 1), s = dfs(k, d - 1, k - 1), cur = 1;
  for (int t = (1); t <= (j); t++) {
    if (t * k >= i) break;
    long long c = dfs(i - t * k, j - t, k - 1);
    cur = cur * (s + t - 1) % mod * inv[t] % mod;
    ret = (ret + c * cur % mod) % mod;
  }
  return dp[i][j][k] = ret;
}
int main() {
  file();
  read(n, d, mod);
  if (n <= 2) return puts("1"), 0;
  inv[1] = 1;
  for (int i = (2); i <= (d); i++)
    inv[i] = 1ll * (mod - mod / i) * inv[mod % i] % mod;
  memset(dp, -1, sizeof(dp));
  long long ans = dfs(n, d, n / 2);
  if (n % 2 == 0) {
    long long s = dfs(n / 2, d - 1, n / 2 - 1);
    ans = (ans - (s * (s - 1) / 2) % mod + mod) % mod;
  }
  cout << ans;
}
