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 = 1010;
const int D = 15;
int dp[N];
int n, d, mod;
int dp2[2][N][D];
int fres = 1;
int fact[N], inv[N];
inline int fastpower(int num, int po) {
  fres = 1;
  while (po > 0) {
    if (po & 1) fres = (long long)fres * num % mod;
    po >>= 1;
    num = (long long)num * num % mod;
  }
  return fres;
}
int gret;
inline int get(int a, int k) {
  if (k == 0) return 1;
  gret = 1;
  for (int i = a + k - 1; i >= a; i--) gret = (long long)gret * i % mod;
  return (long long)gret * inv[k] % mod;
}
vector<int> good;
vector<vector<int> > val;
void solve(int i, int d) {
  for (int j = 0; j < i; j++)
    for (int e = 0; e <= d; e++) dp2[((int)good.size()) & 1][j][e] = 0;
  dp2[((int)good.size()) & 1][0][0] = 1;
  for (int Cur, Nxt, j = (int)good.size() - 1; j >= 0; j--) {
    Cur = (j & 1);
    Nxt = (Cur ^ 1);
    for (int s = 0; s < i; s++) {
      for (int e = 0; e <= d; e++) {
        dp2[Cur][s][e] = 0;
        for (int take = 0; good[j] * take <= s && take <= e; take++) {
          dp2[Cur][s][e] += (long long)val[j][take] *
                            dp2[Nxt][s - good[j] * take][e - take] % mod;
          if (dp2[Cur][s][e] >= mod) dp2[Cur][s][e] -= mod;
        }
      }
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &d, &mod);
  if (n == 1 || d == 2) {
    cout << 1 << endl;
    return 0;
  }
  fact[0] = 1;
  for (int i = 1; i < N; i++) {
    fact[i] = (long long)i * fact[i - 1] % mod;
    inv[i] = fastpower(fact[i], mod - 2);
  }
  dp[1] = 1;
  good.push_back(1);
  val.push_back(vector<int>(d + 1, 1));
  for (int i = 2; i <= n / 2; i++) {
    solve(i, d - 1);
    dp[i] = dp2[0][i - 1][d - 1];
    if (dp[i] > 0) {
      good.push_back(i);
      val.push_back(vector<int>(d + 1));
      for (int l = 0; l <= d; l++) {
        val.back()[l] = get(dp[i], l);
      }
    }
  }
  int ans = 0;
  if (n % 2 == 0) {
    ans += get(dp[n / 2], 2);
  }
  if (good.back() * 2 == n) good.pop_back();
  solve(n, d);
  ans += dp2[0][n - 1][d];
  if (ans >= mod) ans -= mod;
  cout << ans << endl;
  return 0;
}