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 MAXN = 1010;
int P;
template <typename T1, typename T2>
void Inc(T1 &a, T2 b) {
  a += b;
  if (a >= P) a -= P;
}
template <typename T1, typename T2>
void Dec(T1 &a, T2 b) {
  a -= b;
  if (a < 0) a += P;
}
template <typename T1, typename T2>
T1 Add(T1 a, T2 b) {
  a += b;
  return a >= P ? a - P : a;
}
template <typename T1, typename T2>
T1 Sub(T1 a, T2 b) {
  a -= b;
  return a < 0 ? a + P : a;
}
long long ksm(long long a, long long b) {
  long long ret = 1;
  for (; b; b >>= 1, (a *= a) %= P)
    if (b & 1) (ret *= a) %= P;
  return ret;
}
int n, d;
long long f[MAXN][11][MAXN], inv[MAXN];
long long C2(long long x) { return x * (x - 1) / 2 % P; }
int main() {
  scanf("%d%d%d", &n, &d, &P);
  if (n <= 2) return puts("1"), 0;
  for (int i = 0; i <= n; i++) f[1][0][i] = 1;
  inv[1] = 1;
  for (int i = 2; i <= d; i++) inv[i] = Sub(P, P / i) * inv[P % i] % P;
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= d; j++)
      for (int k = 1; k <= n; k++) {
        f[i][j][k] = f[i][j][k - 1];
        long long s = f[k][d - 1][k], C = 1;
        if (k == 1) s = 1;
        for (int m = 1; m * k <= i && m <= j; m++) {
          C = C * (s + m - 1) % P * inv[m] % P;
          Inc(f[i][j][k], f[i - m * k][j - m][k - 1] * C % P);
        }
      }
  long long Ans = f[n][d][n / 2];
  if (~n & 1) Dec(Ans, C2(f[n / 2][d - 1][n / 2]));
  printf("%lld\n", Ans);
}