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 N, D, mod;
int exp(int x, int n) {
  int ret = 1;
  while (n) {
    if (n & 1) ret = 1LL * ret * x % mod;
    x = 1LL * x * x % mod;
    n >>= 1;
  }
  return ret;
}
int inv(int x) { return exp(x, mod - 2); }
int fact[12], invf[12];
int dp1(int n);
int cc2[1010][1010][12];
int dp2(int n, int k, int d) {
  if (n == 0 && d == 0) return 1;
  if (k == 0) return 0;
  int &ret = cc2[n][k][d];
  if (ret != -1) return ret;
  ret = 0;
  int tmp = 1;
  for (int i = 0; i <= min(d, n / k); i++) {
    ret += 1LL * tmp * invf[i] % mod * dp2(n - k * i, k - 1, d - i) % mod;
    ret %= mod;
    tmp = 1LL * tmp * (dp1(k) + i) % mod;
  }
  return ret;
}
int cc1[1010];
int dp1(int n) {
  int &ret = cc1[n];
  if (ret != -1) return ret;
  if (n == 0) return ret = 0;
  if (n == 1) return ret = 1;
  return ret = dp2(n - 1, n - 1, D - 1);
}
int main() {
  cin >> N >> D >> mod;
  fact[0] = 1;
  for (int i = 1; i < 12; i++) {
    fact[i] = 1LL * fact[i - 1] * i % mod;
  }
  for (int i = 0; i < 12; i++) {
    invf[i] = inv(fact[i]);
  }
  if (N == 1) {
    printf("1");
    return 0;
  }
  memset(cc1, -1, sizeof(cc1));
  memset(cc2, -1, sizeof(cc2));
  if (N % 2)
    printf("%d", dp2(N - 1, (N - 1) / 2, D));
  else {
    int ans = dp2(N - 1, (N - 1) / 2, D);
    ans += 1LL * (dp1(N / 2) + 1) * dp1(N / 2) / 2 % mod;
    ans %= mod;
    printf("%d", ans);
  }
}