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;
long long pinv[1111];
long long mod;
long long dp[1111][11][1111][2];
int D;
long long c(long long n, int r) {
  if (n < r) return 0;
  long long ret = 1;
  for (int i = 1; i <= r; i++) {
    ret = ret * n % mod;
    ret = ret * pinv[i] % mod;
    n--;
  }
  return ret;
}
long long f(int n, int sub, int sz, bool can_leaf) {
  long long &ret = dp[n][sub][sz][can_leaf];
  if (ret >= 0) return ret;
  ret = 0;
  if (n == 1) {
    if (sub == 0) return ret = 1;
    return ret = can_leaf;
  }
  if (sz == 0) return ret = 0;
  ret += f(n, sub, sz - 1, can_leaf);
  for (int t = 1;; t++) {
    if (n > t * sz && sub >= t)
      ret = (ret + f(n - t * sz, sub - t, sz - 1, false) *
                       c(f(sz, D - 1, sz - 1, true) + t - 1, t) % mod) %
            mod;
    else
      break;
  }
  return ret;
}
int main() {
  int n;
  scanf("%d%d%lld", &n, &D, &mod);
  memset(dp, -1, sizeof(dp));
  pinv[1] = 1;
  for (int i = 2; i <= 1000; i++) pinv[i] = mod - mod / i * pinv[mod % i] % mod;
  long long ret = f(n, D, n % 2 ? n / 2 : n / 2 - 1, true);
  if (n % 2 == 0)
    ret = (ret + c(f(n / 2, D - 1, n / 2 - 1, true) + 1, 2)) % mod;
  printf("%lld", ret);
}