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>
long long f[1001][11][1001], p, v[20];
int n, d;
long long q(long long a, int t) {
  long long x = 1;
  while (t) {
    if (t & 1) x = x * a % p;
    a = a * a % p;
    t >>= 1;
  }
  return x;
}
long long c(long long a, long long b) {
  long long x = 1;
  for (int i = a - b + 1; i <= a; i++) x = x * i % p;
  for (int i = 1; i <= b; i++) x = x * v[i] % p;
  return x;
}
long long ff(int i, int j, int k) {
  if (k == 0) f[i][j][k] = 0;
  if (i == 1 && j == 0 && k == 0) f[i][j][k] = 1;
  if (i == j + 1 && k == 1) f[i][j][k] = 1;
  if (f[i][j][k] != -1)
    return f[i][j][k];
  else
    f[i][j][k] = 0;
  for (int t = 0; t <= j && t * k <= i; t++) {
    f[i][j][k] +=
        ff(i - t * k, j - t, k - 1) * c(ff(k, d - 1, k - 1) + t - 1, t);
    f[i][j][k] %= p;
  }
  return f[i][j][k];
}
int main() {
  int i, j, k, t;
  long long s, r;
  scanf("%d%d%I64d", &n, &d, &p);
  if (n <= 2) {
    printf("1");
    return 0;
  }
  if ((n - 2) % (d - 1)) {
    printf("0");
    return 0;
  }
  for (i = 1; i <= d; i++) v[i] = q(i, p - 2);
  memset(f, 0xFF, sizeof(f));
  s = ff(n, d, (n - 1) / 2);
  r = ff(n / 2, d - 1, n / 2 - 1);
  if (n % 2 == 0) s += r * (r + 1) / 2, s %= p;
  printf("%I64d", s);
  return 0;
}