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 = 1005;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
namespace ModCalculator {
int MOD;
inline void Inc(int &x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
inline void Dec(int &x, int y) {
  x -= y;
  if (x < 0) x += MOD;
}
inline int Add(int x, int y) {
  Inc(x, y);
  return x;
}
inline int Sub(int x, int y) {
  Dec(x, y);
  return x;
}
inline int Mul(int x, int y) { return 1LL * x * y % MOD; }
inline int ksm(int x, int k) {
  int ret = 1;
  for (; k; k >>= 1) {
    if (k & 1) ret = Mul(ret, x);
    x = Mul(x, x);
  }
  return ret;
}
inline int Inv(int x) { return ksm(x, MOD - 2); }
}  // namespace ModCalculator
using namespace ModCalculator;
int N, D;
int inv[MAXN], dp[MAXN][11][MAXN];
int DP(int n, int d, int k) {
  k = min(k, n - 1);
  if (n == 1) return (d == 0 || d == D - 1);
  if (!k) return 0;
  if (~dp[n][d][k]) return dp[n][d][k];
  int ret = DP(n, d, k - 1);
  int son = DP(k, D - 1, k), C = 1;
  for (int i = 1; i <= d && i * k < n; ++i) {
    C = Mul(C, Mul(son + i - 1, inv[i]));
    Inc(ret, Mul(C, DP(n - i * k, d - i, k - 1)));
  }
  return dp[n][d][k] = ret;
}
void solve() {
  read(N);
  read(D);
  read(MOD);
  if (N <= 2) {
    puts("1");
    return;
  }
  inv[0] = inv[1] = 1;
  for (int i = 2; i <= N; ++i) {
    inv[i] = Mul(MOD - MOD / i, inv[MOD % i]);
  }
  memset(dp, -1, sizeof(dp));
  int ans = DP(N, D, (N - 1) / 2);
  if (N % 2 == 0) {
    int half = DP(N / 2, D - 1, N / 2 - 1);
    Inc(ans, Mul(Mul(half, half + 1), inv[2]));
  }
  printf("%d\n", ans);
}
int main() {
  solve();
  return 0;
}