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 = 1005;
const int M = 12;
long long MOD;
long long dp[N][M][N];
long long curCom[M];
long long inv2[M];
long long inv1[M];
inline long long mypow(long long a, long long b) {
  int res = 1;
  while (b) {
    if (b & 1) {
      res = ((long long)res * a) % MOD;
    }
    a = ((long long)a * a) % MOD;
    b >>= 1;
  }
  return res;
}
inline long long cmb(long long a, long long b) {
  long long d1, d2;
  if (a < b) {
    return 0;
  }
  d1 = 1;
  d2 = inv2[b];
  while (b) {
    d1 = (long long)d1 * a % MOD;
    b--;
    a--;
  }
  return (long long)d1 * d2 % MOD;
}
void calCurCom(long long n, int m) {
  memset(curCom, 0, sizeof(curCom));
  if (n = 0) {
    return;
  }
  int i, j;
  long long d1, d2;
  long long tmp = n + m - 1;
  for (i = m; i >= 1; i--, tmp--) {
    inv1[i] = mypow(tmp, MOD - 2);
  }
  d1 = d2 = 1;
}
int main() {
  int n, d, i, j, k, l;
  scanf("%d%d%lld", &n, &d, &MOD);
  if (n <= 2) {
    printf("1\n");
    return 0;
  }
  long long tmp = 1;
  inv1[0] = 1;
  inv2[1] = 1;
  for (i = 2; i <= d; i++) {
    tmp = tmp * i;
    inv2[i] = mypow(tmp, MOD - 2);
  }
  for (k = 0; k <= n; k++) {
    dp[1][0][k] = 1;
  }
  for (i = 2; i <= d + 1; i++) {
    for (k = 1; k <= n; k++) {
      dp[i][i - 1][k] = 1;
    }
  }
  for (i = 3; i <= n; i++) {
    for (j = 1; j <= d && j < i - 1; j++) {
      for (k = 2; k <= n - 1; k++) {
        dp[i][j][k] = dp[i][j][k - 1];
        for (l = 1; l <= j && l * k < i; l++) {
          tmp = (long long)dp[i - k * l][j - l][k - 1] *
                cmb(dp[k][d - 1][k - 1] + l - 1, l) % MOD;
          dp[i][j][k] = ((long long)dp[i][j][k] + tmp) % MOD;
        }
      }
    }
  }
  long long ans = 0;
  ans = dp[n][d][(n + 1) / 2 - 1];
  if ((n & 1) == 0) {
    ans = ((long long)ans + cmb(dp[n / 2][d - 1][n / 2 - 1] + 1, 2)) % MOD;
  }
  printf("%lld\n", ans);
  return 0;
}