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;
struct sam {
  int son[1057 << 1][26], pre[1057 << 1], dis[1057 << 1];
  int Right[1057 << 1];
  int p, np, q, nq, lst, cnt;
  int lth;
  char read_s[1057];
  void insert(int x) {
    dis[np = ++cnt] = dis[p = lst] + 1;
    Right[np] = 1, lst = np;
    for (; p && !son[p][x]; p = pre[p]) son[p][x] = np;
    if (!p) return pre[np] = 1, void();
    q = son[p][x];
    if (dis[q] == dis[p] + 1)
      return pre[np] = q, void();
    else {
      dis[nq = ++cnt] = dis[p] + 1;
      memcpy(son[nq], son[q], sizeof son[q]);
      pre[nq] = pre[q];
      pre[q] = pre[np] = nq;
      for (; p && son[p][x] == q; p = pre[p]) son[p][x] = nq;
    }
  }
  void build() {
    lst = cnt = 1;
    scanf("%s", read_s);
    lth = strlen(read_s);
    for (int i = 0; i < lth; ++i) insert(read_s[i] - 'a');
  }
  void build_() {
    lst = cnt = 1;
    scanf("%s", read_s);
    lth = strlen(read_s);
    for (int i = lth - 1; ~i; --i) insert(read_s[i] - 'a');
  }
  int s[1057 << 1], v[1057 << 1];
  void sort() {
    for (int i = 1; i <= cnt; ++i) ++v[dis[i]];
    for (int i = 1; i <= lth; ++i) v[i] += v[i - 1];
    for (int i = 1; i <= cnt; ++i) s[v[dis[i]]--] = i;
  }
  long long ans;
  void DP() {
    for (int i = cnt; i; --i) {
      int now = s[i], fth = pre[now];
      Right[fth] += Right[now];
      ans += 1ll * (dis[now] - dis[fth]) * Right[now] * (lth - Right[now]);
    }
  }
} SAM;
int n, d, MOD;
const int MAXD = 15;
int dp[1057][1057][MAXD];
int Inv[1057];
inline void update(int &a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
int qpow(int a, int b) {
  int tmp = a, ret = 1;
  for (; b; b >>= 1, tmp = 1LL * tmp * tmp % MOD) {
    if (b & 1) ret = 1LL * ret * tmp % MOD;
  }
  return ret;
}
void Init() {
  for (int i = 1; i <= 1000; i++) {
    Inv[i] = qpow(i, MOD - 2);
  }
}
int f[1057];
void Dodp() {
  f[1] = 1;
  dp[0][0][0] = 1;
  for (int j = 0; j <= d; j++) {
    dp[1][j][j] = 1;
  }
  for (int i = 2; i + i <= n; i++) {
    f[i] = dp[i - 1][i - 1][d - 1];
    for (int k = 0; k <= d; k++) {
      for (int j = 0; j <= n; j++) {
        if (dp[i - 1][j][k]) {
          int tmp = dp[i - 1][j][k];
          for (int use = 0; j + use * i <= n && use + k <= d && tmp; use++) {
            update(dp[i][j + use * i][use + k], tmp);
            tmp = 1LL * tmp * (f[i] + use) % MOD * Inv[use + 1] % MOD;
          }
        }
      }
    }
  }
}
void Solve() {
  if (n <= 2) {
    puts("1");
    return;
  }
  if (n & 1) {
    printf("%d\n", dp[n >> 1][n - 1][d]);
  } else {
    int ans = dp[(n >> 1) - 1][n - 1][d], tmp = f[n >> 1];
    tmp = 1LL * (tmp + 1) * tmp % MOD * Inv[2] % MOD;
    ans = (ans + tmp) % MOD;
    printf("%d\n", ans);
  }
}
int main() {
  scanf("%d%d%d", &n, &d, &MOD);
  Init();
  Dodp();
  Solve();
}