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;
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;
}