Problem: A tree is a connected graph without cycles.

Two trees, consisting of n vertices each, are called isomorphic if there exists a permutation p: {1, ..., n} → {1, ..., n} such that the edge (u, v) is present in the first tree if and only if the edge (pu, pv) is present in the second tree.

Vertex of the tree is called internal if its degree is greater than or equal to two.

Count the number of different non-isomorphic trees, consisting of n vertices, such that the degree of each internal vertex is exactly d. Print the answer over the given prime modulo mod.

Input

The single line of the input contains three integers n, d and mod (1 ≤ n ≤ 1000, 2 ≤ d ≤ 10, 108 ≤ mod ≤ 109) — the number of vertices in the tree, the degree of internal vertices and the prime modulo.

Output

Print the number of trees over the modulo mod.

Examples

Input

5 2 433416647


Output

1


Input

10 3 409693891


Output

2


Input

65 4 177545087


Output

910726

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <class T>
bool ckmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <class T>
bool ckmin(T &x, T y) {
  return x > y ? x = y, 1 : 0;
}
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f ? x : -x;
}
const int N = 1005;
int fac[N], ifc[N], n, d, mod, f[N][12][N], ans;
inline int add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
inline int sub(int x, int y) { return (x -= y) < 0 ? x + mod : x; }
inline int qpow(int n, int k) {
  int res = 1;
  for (; k; k >>= 1, n = (long long)n * n % mod)
    if (k & 1) res = (long long)res * n % mod;
  return res;
}
inline void init(const int &n = N - 1) {
  fac[0] = 1;
  for (int i = 1, iend = n; i <= iend; ++i)
    fac[i] = (long long)i * fac[i - 1] % mod;
  ifc[n] = qpow(fac[n], mod - 2);
  for (int i = n - 1, iend = 0; i >= iend; --i)
    ifc[i] = (long long)(i + 1) * ifc[i + 1] % mod;
}
inline int comb(int n, int m) {
  int res = ifc[m];
  for (int i = 0, iend = m - 1; i <= iend; ++i)
    res = (long long)res * (n - i) % mod;
  return res;
}
signed main() {
  n = read(), d = read(), mod = read();
  init();
  if (n == 1) return puts("1"), 0;
  if (n == 2) return puts("1"), 0;
  for (int i = 0, iend = n; i <= iend; ++i) f[1][0][i] = 1;
  for (int i = 2, iend = n; i <= iend; ++i) {
    for (int j = 1, jend = min(i - 1, d); j <= jend; ++j) {
      for (int k = 1, kend = n; k <= kend; ++k) {
        f[i][j][k] = f[i][j][k - 1];
        for (int l = 1, lend = j; l <= lend; ++l) {
          if (i - l * k < 0) break;
          if (k > 1)
            f[i][j][k] =
                add(f[i][j][k], (long long)f[i - l * k][j - l][k - 1] *
                                    comb(f[k][d - 1][k - 1] + l - 1, l) % mod);
          else
            f[i][j][k] =
                add(f[i][j][k], (long long)f[i - l * k][j - l][k - 1] *
                                    comb(f[k][0][k - 1] + l - 1, l) % mod);
        }
      }
    }
  }
  ans = f[n][d][n / 2];
  if (n % 2 == 0) ans = sub(ans, comb(f[n / 2][d - 1][n / 2 - 1], 2));
  cout << ans << '\n';
}