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>
const int MAXN = 1000, MAXD = 20;
int n, d, Mod;
int Add(int x, int y) {
  x += y;
  return x >= Mod ? x - Mod : x;
}
int Sub(int x, int y) {
  x -= y;
  return x < 0 ? x + Mod : x;
}
int Quick_pow(int x, int po) {
  int Ans = 1;
  for (; po; po >>= 1, x = 1ll * x * x % Mod)
    if (po & 1) Ans = 1ll * Ans * x % Mod;
  return Ans;
}
int Inverse(int x) { return Quick_pow(x, Mod - 2); }
int Fac[MAXD + 5], Inv[MAXD + 5];
void Init() {
  Fac[0] = 1;
  for (int i = 1; i <= MAXD; i++) Fac[i] = 1ll * Fac[i - 1] * i % Mod;
  Inv[MAXD] = Inverse(Fac[MAXD]);
  for (int i = MAXD; i >= 1; i--) Inv[i - 1] = 1ll * Inv[i] * i % Mod;
}
int C(int n, int m) {
  int Ans = 1;
  for (int i = n; i >= n - m + 1; i--) Ans = 1ll * Ans * i % Mod;
  return 1ll * Ans * Inv[m] % Mod;
}
int dp[MAXN + 5][MAXD + 1][MAXN / 2 + 5];
int dfs(int Sz, int nowd, int MaxSz) {
  if (dp[Sz][nowd][MaxSz] != -1) return dp[Sz][nowd][MaxSz];
  if (Sz == 1) return dp[Sz][nowd][MaxSz] = nowd == 0;
  if (MaxSz == 1) return dp[Sz][nowd][MaxSz] = Sz == nowd + 1;
  if (!nowd || !MaxSz || nowd >= Sz) return dp[Sz][nowd][MaxSz] = 0;
  int Ans = 0;
  for (int t = 0; t * MaxSz < Sz && t <= nowd; t++)
    Ans = Add(Ans, 1ll * C(dfs(MaxSz, d - 1, MaxSz - 1) + t - 1, t) *
                       dfs(Sz - t * MaxSz, nowd - t, MaxSz - 1) % Mod);
  return dp[Sz][nowd][MaxSz] = Ans;
}
int main() {
  scanf("%d %d %d", &n, &d, &Mod);
  if (n == 1 || n == 2) return printf("1\n") & 0;
  Init();
  memset(dp, -1, sizeof(dp));
  if (n & 1)
    printf("%d\n", dfs(n, d, n / 2));
  else
    printf("%d\n", Sub(dfs(n, d, n / 2), C(dfs(n / 2, d - 1, n / 2 - 1), 2)));
  return 0;
}