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;
long long n, d, mod, f[1100][11], jc[11];
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - 48;
    ch = getchar();
  }
  return x * f;
}
inline long long ksm(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans % mod;
}
int main() {
  n = read();
  d = read();
  mod = read();
  if (n <= 2) {
    cout << 1;
    return 0;
  }
  f[1][d - 1] = f[1][0] = jc[1] = 1;
  for (int i = 2; i <= d; i++) jc[i] = jc[i - 1] * i;
  for (int i = 2; i <= d; i++) jc[i] = ksm(jc[i], mod - 2);
  for (int k = 1; k <= n / 2; k++) {
    if (!f[k][d - 1]) continue;
    long long tmp = f[k][d - 1], cs = 0;
    for (int i = n; i >= k + 1; i--) {
      for (int j = 1; j <= d; j++) {
        tmp = f[k][d - 1];
        cs = 0;
        for (int t = 1; t <= j && t * k <= i; t++) {
          if (t != 1) tmp *= (++cs + f[k][d - 1]), tmp %= mod;
          f[i][j] += (f[i - k * t][j - t] * tmp % mod) * jc[t] % mod;
          f[i][j] %= mod;
        }
      }
    }
  }
  if (n % 2)
    cout << f[n][d] % mod;
  else {
    f[n][d] -= f[n / 2][d - 1] * (f[n / 2][d - 1] - 1) % mod * jc[2] % mod;
    cout << (f[n][d] + mod) % mod;
  }
}