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;
template <class T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
template <class T>
inline void umin(T &x, T y) {
  x = x < y ? x : y;
}
template <class T>
inline void umax(T &x, T y) {
  x = x > y ? x : y;
}
inline unsigned int R() {
  static unsigned int seed = 416;
  return seed ^= seed >> 5, seed ^= seed << 17, seed ^= seed >> 13;
}
const int N = 1234;
int n, d, mo, dp[N], f[N][N][11], inv[N];
int power(int a, int n) {
  int res = 1;
  while (n) {
    if (n & 1) res = 1LL * res * a % mo;
    a = 1LL * a * a % mo;
    n >>= 1;
  }
  return res;
}
inline int calc(int tot, int c, int now) { return tot == 0 ? (c == 0) : now; }
inline void add(int &x, int y) { x = x + y < mo ? x + y : x + y - mo; }
int main() {
  read(n);
  read(d);
  read(mo);
  int mx = N - 1;
  if (n == 1) {
    puts("1");
    return 0;
  }
  inv[1] = 1;
  for (register int i = (2); i <= (N - 1); i++)
    inv[i] = 1LL * (mo - mo / i) * inv[mo % i] % mo;
  f[0][0][0] = 1;
  for (register int i = (1); i <= (n); i++) {
    dp[i] = f[i - 1][i - 1][d - 1];
    if (i == 1) dp[i] = 1;
    for (register int j = (0); j <= (n); j++)
      for (register int k = (0); k <= (d); k++)
        if (f[i - 1][j][k])
          for (int c = 0, now = 1; k + c <= d && j + i * c <= n; c++) {
            add(f[i][j + i * c][k + c],
                1LL * f[i - 1][j][k] * calc(dp[i], c, now) % mo);
            now = 1LL * now * (dp[i] + c) % mo * inv[c + 1] % mo;
          }
  }
  printf("%d", ((n % 2 == 0 ? 1LL * (dp[n / 2] + 1) * dp[n / 2] / 2 % mo : 0) +
                f[(n - 1) / 2][n - 1][d]) %
                   mo);
  return 0;
}