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 MAXN = 1e3 + 10;
const int MAXD = 15;
int n, d, MOD;
int phi;
void add(int& x, int y) { ((x += y) >= MOD) && (x -= MOD); }
int mul(int x, int y) { return x * 1ll * y % MOD; }
bool read() {
  if (scanf("%d%d%d", &n, &d, &MOD) < 3) {
    return false;
  }
  return true;
}
int dp[MAXD][MAXN][MAXN];
int mpow(int a, int p) {
  int res = 1;
  for (; p > 0; a = mul(a, a), p >>= 1) {
    if (p & 1) {
      res = mul(res, a);
    }
  }
  return res;
}
int inv[MAXD];
void precalc() {
  for (int i = 1; i < MAXD; ++i) {
    inv[i] = mpow(i, MOD - 2);
    assert(mul(i, inv[i]) == 1);
  }
}
int solve() {
  if (n <= 2) {
    return 1;
  }
  int ans = 0;
  memset(dp, 0, sizeof dp);
  for (int last = 0; last < (int)n + 1; ++last) {
    dp[0][0][last] = 1;
  }
  for (int sum = 0; sum <= n; ++sum) {
    for (int sons = 1; sons <= d; ++sons) {
      for (int cur = 1; cur <= n; ++cur) {
        add(dp[sons][sum][cur], dp[sons][sum][cur - 1]);
        if (cur * 2 > n) {
          continue;
        }
        int A = cur == 1 ? 1 : dp[d - 1][cur - 1][n];
        int B = 1;
        int C = A / B;
        for (int cnt_cur = 1; sum - cnt_cur * cur >= 0 && sons - cnt_cur >= 0;
             ++cnt_cur) {
          int aux = mul(dp[sons - cnt_cur][sum - cnt_cur * cur][cur - 1], C);
          add(dp[sons][sum][cur], aux);
          if (sons == d && sum == n - 1) {
            if ((n - cur) * 2 > n) {
              add(ans, aux);
            }
          }
          add(A, 1);
          add(B, 1);
          C = mul(C, A);
          C = mul(C, inv[B]);
        }
      }
    }
  }
  for (int left_________________ = d - 1; left_________________ <= n - 2;
       ++left_________________) {
    int right_______________ = n - 2 - left_________________;
    if (right_______________ < d - 1 ||
        left_________________ > right_______________) {
      continue;
    }
    if ((left_________________ + 1) * 2 > n ||
        (right_______________ + 1) * 2 > n) {
      continue;
    }
    int cur_ans = mul(dp[d - 1][left_________________][n],
                      dp[d - 1][right_______________][n]);
    if (left_________________ == right_______________) {
      cur_ans = mul(dp[d - 1][left_________________][n],
                    dp[d - 1][left_________________][n] + 1);
      cur_ans = mul(cur_ans, inv[2]);
    }
    add(ans, cur_ans);
  }
  return ans;
}
int main() {
  while (read()) {
    precalc();
    printf("%d\n", solve());
  }
  return 0;
}