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, typename U>
void chkmax(T& x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
void chkmin(T& x, U y) {
  if (y < x) x = y;
}
const int MAXN = 1111;
int N, D, MOD;
int dp[12][MAXN];
int r[MAXN], C[MAXN];
int main() {
  cin >> N >> D >> MOD;
  r[1] = 1;
  for (int i = 2; i < MAXN; i++) {
    r[i] = (long long)(MOD - r[MOD % i]) * (MOD / i) % MOD;
  }
  if (D == 2) {
    puts("1");
    return 0;
  }
  int M = N / 2;
  D--, dp[D][1] = dp[D + 1][1] = 1;
  dp[0][1] = 1;
  for (int i = 1; i <= M; i++) {
    int cur = dp[D][i];
    C[0] = 1;
    for (int k = 1; k <= D + 1; k++)
      C[k] = (long long)C[k - 1] * (cur + k - 1) % MOD * r[k] % MOD;
    for (int k = D + 1; k > 0; k--) {
      for (int j = N; j > i; j--) {
        for (int l = k - 1; l >= 0; l--) {
          if (j >= i * (k - l))
            dp[k][j] =
                (dp[k][j] + (long long)dp[l][j - i * (k - l)] * C[k - l]) % MOD;
        }
      }
    }
  }
  int ans = dp[D + 1][N];
  if (N + 1 & 1)
    ans =
        (ans + (long long)(MOD - dp[D][M]) * (dp[D][M] - 1) % MOD * r[2]) % MOD;
  cout << ans << endl;
  return 0;
}