#include <bits/stdc++.h>
using namespace std;
template <class T, class S>
ostream& operator<<(ostream& os, const pair<T, S>& v) {
  return os << "(" << v.first << ", " << v.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[";
  for (int i = int(0); i <= int((static_cast<int>((v).size())) - 1); ++i) {
    if (i) os << ", ";
    os << v[i];
  }
  return os << "]";
}
template <class T>
bool setmax(T& _a, T _b) {
  if (_b > _a) {
    _a = _b;
    return true;
  }
  return false;
}
template <class T>
bool setmin(T& _a, T _b) {
  if (_b < _a) {
    _a = _b;
    return true;
  }
  return false;
}
template <class T>
T gcd(T _a, T _b) {
  return _b == 0 ? _a : gcd(_b, _a % _b);
}
const int N = 1010;
const int D = 11;
long long f[N][D][N];
long long inv[D];
int main() {
  int n, d;
  long long mod;
  cin >> n >> d >> mod;
  const auto power = [mod](long long a, long long b) {
    long long c = 1;
    for (; b > 0; b >>= 1, a = a * a % mod)
      if (b & 1) c = c * a % mod;
    return c;
  };
  for (int i = int(1); i <= int(D - 1); ++i) inv[i] = power(i, mod - 2);
  memset(f, 0, sizeof(f));
  for (int j = int(0); j <= int(d); ++j)
    for (int k = int(0); k <= int(n); ++k) f[1][j][k] = 1;
  for (int i = int(2); i <= int(n); ++i)
    for (int j = int(0); j <= int(d); ++j)
      for (int k = int(1); k <= int(n); ++k) {
        long long cur = 1, p = f[k][d - 1][k - 1];
        long long ans = 0;
        for (int t = int(0); t <= int(min(j, (i - 1) / k)); ++t) {
          if (i - t * k != 1 || (i - t * k == 1 && j == t)) {
            ans += f[i - t * k][j - t][k - 1] * cur;
          }
          (cur *= p + t) %= mod;
          (cur *= inv[t + 1]) %= mod;
        }
        f[i][j][k] = ans % mod;
      }
  long long ans = f[n][d][(n - 1) / 2];
  if (n % 2 == 0) {
    long long tmp = f[n / 2][d - 1][n / 2 - 1];
    (ans += tmp * (tmp + 1) / 2) %= mod;
  }
  cout << ans << endl;
  return 0;
}
