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 = 1007, D = 11, C = 20;
int M, dd, mod;
int dp[N][N][D];
int rev[C];
long long power(int a, int b) {
  if (b == 0) return 1;
  long long res = power(a, b / 2);
  res *= res, res %= mod;
  if (b & 1) res *= a, res %= mod;
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> M >> dd >> mod;
  if (M <= 2) return cout << 1 << endl, 0;
  if (dd == 2) return cout << 1 << endl, 0;
  if ((M - 2) % (dd - 1) != 0) return cout << 0 << endl, 0;
  int n = (M - 2) / (dd - 1);
  for (int i = 0; i < C; i++) rev[i] = power(i, mod - 2);
  for (int i = 0; i <= dd; i++) {
    dp[1][0][i] = 1;
    for (int j = 1; j < N; j++) dp[1][j][i] = 1;
  }
  for (int a = 2; a <= n; a++)
    for (int x = 1; x < N; x++)
      for (int d = 1; d < D; d++) {
        dp[a][x][d] = dp[a][x - 1][d];
        long long comb = dp[x][x - 1][dd - 1], t = dp[x][x - 1][dd - 1];
        for (int c = 1; c * x < a && d >= c; c++) {
          long long way = dp[a - c * x][x - 1][d - c];
          way *= comb;
          way %= mod;
          dp[a][x][d] += way, dp[a][x][d] %= mod;
          comb *= (c + t) % mod, comb %= mod, comb *= rev[c + 1], comb %= mod;
        }
      }
  long long t1 = dp[n][(n - 1) / 2][dd];
  if (n & 1) return cout << t1 << endl, 0;
  long long t2 = (1LL * dp[n / 2][n / 2 - 1][dd - 1] *
                  (dp[n / 2][n / 2 - 1][dd - 1] + 1) % mod) *
                 rev[2] % mod;
  t1 += t2, t1 %= mod;
  cout << t1 << endl;
}