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 <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  int f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  };
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
int n, d, mod;
inline int mul(int x, int y) { return 1ll * x * y % mod; }
int add(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }
int sub(int x, int y) { return x - y < 0 ? x - y + mod : x - y; }
int sq(int x) { return 1ll * x * x % mod; }
int pow(int a, int b) {
  return b == 0 ? 1 : (b & 1 ? mul(a, sq(pow(a, b / 2))) : sq(pow(a, b / 2)));
}
int dp[1010][505][15], inv[15];
int main() {
  read(n);
  read(d);
  read(mod);
  if (n <= 2) {
    cout << 1 << endl;
    return 0;
  }
  for (int i = 1; i < 15; i++) {
    inv[i] = pow(i, mod - 2);
  }
  dp[1][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= n / 2; j++) {
      for (int k = 0; k <= d; k++) {
        if (j == 0)
          dp[i][j][k] = (i == 1 && k == 0);
        else
          dp[i][j][k] = add(dp[i][j][k], dp[i][j - 1][k]);
        if (j != 0) {
          int cu = 1;
          for (int t = 1; t <= k && t * j < i; t++) {
            if (j != 1) cu = mul(cu, mul(dp[j][j - 1][d - 1] + t - 1, inv[t]));
            dp[i][j][k] =
                add(dp[i][j][k], mul(dp[i - t * j][j - 1][k - t], cu));
          }
        }
      }
    }
  }
  int ans = dp[n][(n - 1) / 2][d];
  if (n % 2 == 0) {
    ans = add(ans, mul((mod + 1) / 2, mul(dp[n / 2][n / 2 - 1][d - 1] + 1,
                                          dp[n / 2][n / 2 - 1][d - 1])));
  }
  cout << ans << endl;
  return 0;
}