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 double pi = acos(-1.0);
const int N = 1005;
int P;
inline int Pow(int a, int b) {
  int c = 1;
  for (; b; b >>= 1, a = a * 1ll * a % P)
    if (b & 1) c = c * 1ll * a % P;
  return c;
}
inline void add(int &a, int b) {
  a += b;
  if (a >= P) a -= P;
}
inline void dec(int &a, int b) {
  a -= b;
  if (a < 0) a += P;
}
int n, d;
int fac[N], inv[N];
int f[N][11];
int ji(int a, int b) {
  int res = 1;
  for (int i = (int)0; i <= (int)b - 1; i++) res = res * 1ll * (a + i) % P;
  return res;
}
int main() {
  scanf("%d%d%d", &n, &d, &P);
  if (n <= 2) {
    printf("1");
    return 0;
  }
  fac[0] = 1;
  for (int i = (int)1; i <= (int)n; i++) fac[i] = fac[i - 1] * 1ll * i % P;
  inv[n] = Pow(fac[n], P - 2);
  for (int i = (int)n - 1; i >= (int)0; i--)
    inv[i] = inv[i + 1] * 1ll * (i + 1) % P;
  for (int k = (int)0; k <= (int)d; k++) f[1 + k][k] = 1;
  for (int i = (int)1; i <= (int)(n - 1) / 2; i++) {
    int way = f[i][d - 1];
    for (int j = (int)n; j >= (int)1; j--)
      for (int k = (int)0; k <= (int)d - 1; k++)
        if (f[j][k]) {
          int rest = n - j;
          int dd = way;
          for (int use = (int)1; use <= (int)rest / i; use++) {
            if (k + use > d) break;
            add(f[j + use * i][k + use],
                (f[j][k] * 1ll * dd % P) * 1ll * inv[use] % P);
            dd = dd * 1ll * (way + use) % P;
          }
        }
  }
  if (n % 2 == 0) {
    int ans = f[n / 2][d - 1];
    add(ans, (f[n / 2][d - 1] * 1ll * (f[n / 2][d - 1] - 1) / 2) % P);
    add(ans, f[n][d]);
    printf("%d\n", ans);
  } else {
    printf("%d\n", f[n][d]);
  }
  return 0;
}