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 N = 1010, D = 15;
int i, j, k, l, n, m, d, P, ans, t;
int f[N][D], Jc[D], Jc_[D], inv[D], tmp[D];
int ksm(int x, int y) {
  int z = 1;
  for (; y; y >>= 1, x = (long long)x * x % P)
    if (y & 1) z = (long long)z * x % P;
  return z;
}
void pre(int n) {
  int i;
  Jc[0] = Jc_[0] = 1;
  for (i = 1; i <= n; i++) Jc[i] = (long long)Jc[i - 1] * i % P;
  Jc_[n] = ksm(Jc[n], P - 2);
  for (i = n - 1; i; i--) Jc_[i] = (long long)Jc_[i + 1] * (i + 1) % P;
  for (i = 1; i <= n; i++) inv[i] = (long long)Jc_[i] * Jc[i - 1] % P;
}
int main() {
  scanf("%d%d%d", &n, &d, &P);
  pre(d);
  f[1][0] = 1;
  f[1][d - 1] = 1;
  for (k = 1; k <= n / 2; k++)
    if (f[k][d - 1]) {
      m = f[k][d - 1];
      tmp[0] = 1;
      for (l = 1; l <= d; l++)
        tmp[l] = (long long)tmp[l - 1] * (l + m - 1) % P * inv[l] % P;
      for (i = n - k; i; i--)
        for (j = 0; j < d; j++)
          if (f[i][j])
            for (l = 1; i + l * k <= n && j + l <= d; l++)
              f[i + l * k][j + l] =
                  ((long long)f[i][j] * tmp[l] + f[i + l * k][j + l]) % P;
    }
  ans = (f[n][d] + f[n][0]) % P;
  if (!(n & 1)) {
    t = f[n / 2][d - 1];
    ans = (ans + P - (long long)t * (t - 1) / 2 % P) % P;
  }
  printf("%d\n", ans);
}