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;
inline void read(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void read(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void readc(char &x) {
  char c;
  while (((c = getchar()) == ' ') || c == '\n')
    ;
  x = c;
}
int mod;
int n, d, i, j, k, p, f[1005][505][11], fac[1005], inv[1005], first[1005];
int c(int x, int y) {
  int s = 1, i;
  for (((i)) = (1); ((i)) <= ((y)); ((i))++) {
    s = 1ll * s * (x - i + 1) % mod * inv[i] % mod;
  }
  return s;
}
int main() {
  read(n);
  read(d);
  read(mod);
  fac[0] = fac[1] = first[0] = first[1] = inv[1] = 1;
  for ((i) = (2); (i) <= (1000); (i)++) {
    fac[i] = 1ll * fac[i - 1] * i % mod;
    inv[i] = 1ll * (mod - mod / i) * inv[mod % i] % mod;
    first[i] = 1ll * first[i - 1] * inv[i] % mod;
  }
  if (n <= 2) {
    puts("1");
    return 0;
  }
  for ((i) = (0); (i) <= (n / 2); (i)++) {
    f[1][i][0] = 1;
  }
  f[1][0][d - 1] = 1;
  for ((i) = (2); (i) <= (n); (i)++) {
    for (((j)) = (1); ((j)) <= ((n / 2)); ((j))++) {
      for (((k)) = (1); ((k)) <= ((min(i - 1, d))); ((k))++) {
        f[i][j][k] = f[i][j - 1][k];
        for (p = 1; p * j <= i && p <= k; p++) {
          f[i][j][k] = (f[i][j][k] + 1ll * f[i - p * j][j - 1][k - p] *
                                         c(f[j][j - 1][d - 1] + p - 1, p)) %
                       mod;
        }
      }
    }
  }
  if (n & 1) {
    cout << f[n][n / 2][d] << endl;
  } else {
    cout << (f[n][n / 2][d] - c(f[n / 2][n / 2 - 1][d - 1], 2) + mod) % mod
         << endl;
  }
  return 0;
}