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 = 1005;
const int D = 15;
int n, d;
long long mod, f[N][N][D], fact[2 * N], inv[2 * N], ifact[2 * N];
int power(int a, int n) {
  int result = 1;
  while (n > 0) {
    if (n & 1) result = (1LL * result * a) % mod;
    a = (1LL * a * a) % mod;
    n /= 2;
  }
  return result;
}
int main() {
  cin >> n >> d >> mod;
  if (n <= 2) {
    cout << 1 << endl;
    return 0;
  }
  fact[0] = inv[0] = ifact[0] = 1;
  for (int i = 1; i < 2 * N; ++i) {
    fact[i] = (fact[i - 1] * i) % mod;
    inv[i] = power(i, mod - 2);
    ifact[i] = (ifact[i - 1] * inv[i]) % mod;
  }
  for (int i = 0; i <= n; ++i) {
    f[1][i][0] = 1;
    if (i > 0) f[2][i][1] = 1;
  }
  for (int i = 3; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int x = 1; x <= d; ++x) {
        long long& current = f[i][j][x];
        if (x > i) continue;
        if (j == 1) {
          if (i == x + 1) {
            current = 1;
          }
          continue;
        }
        current = (current + f[i][j - 1][x]) % mod;
        long long up = 1;
        for (int y = 1; y <= x; ++y) {
          if (i <= y * j) continue;
          up = (up * (f[j][j][d - 1] + y - 1)) % mod;
          current =
              (current + f[i - y * j][j - 1][x - y] * up % mod * ifact[y]) %
              mod;
        }
      }
    }
  }
  long long result = f[n][(n - 1) / 2][d];
  if (n % 2 == 0) {
    long long current;
    current = f[n / 2][n / 2 - 1][d - 1];
    current = (1LL * current * (current + 1) % mod * inv[2]) % mod;
    result = (result + current) % mod;
  }
  cout << result << endl;
  return 0;
}