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;
const int N = 1010;
int n, d, mod, g[N][11], f[N][11], ans, q[N], t;
int Pow(int a, int b) {
  if (b == 0) return 1;
  int ret = Pow(a, b / 2);
  ret = 1LL * ret * ret % mod;
  if (b & 1) ret = 1LL * ret * a % mod;
  return ret;
}
int main() {
  scanf("%d%d%d", &n, &d, &mod);
  if (n <= 2) {
    cout << 1 << endl;
    return 0;
  }
  if ((n - 2) % (d - 1) != 0) {
    cout << 0 << endl;
    return 0;
  }
  g[1][0] = 1;
  for (int i = 1; i <= n / 2; i++) {
    if (i == 1)
      t = 1;
    else
      t = g[i][d - 1];
    q[0] = 1;
    for (int k = 1; k <= d; k++)
      q[k] = 1LL * q[k - 1] * (t++) % mod * Pow(k, mod - 2) % mod;
    memcpy(f, g, sizeof(f));
    for (int k = 1; k * i < n; k++)
      for (int j = 1; j + k * i <= n; j++)
        for (int p = 0; p + k <= d; p++) {
          f[j + k * i][p + k] =
              (f[j + k * i][p + k] + 1LL * g[j][p] * q[k]) % mod;
        }
    memcpy(g, f, sizeof(f));
  }
  ans = g[n][d];
  if (n % 2 == 0) {
    ans = (ans - 1LL * (g[n / 2][d - 1] - 1) * g[n / 2][d - 1] % mod *
                     Pow(2, mod - 2)) %
          mod;
  }
  ans = (ans + mod) % mod;
  printf("%d\n", ans);
  return 0;
}