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;
int n, d, mo, inv[20], dp[1005][11][1005];
void ntr(int &x) { x = x >= mo ? x - mo : (x < 0 ? x + mo : x); }
void inc(int &x, int y) { x += y, ntr(x); }
long long qry(int x, int y) {
  if (y == 0) return 1;
  if (x == 0) return 0;
  x = x + y - 1;
  long long r = 1;
  for (int i = 1; i <= y; i++) r = r * (x - i + 1) % mo;
  return r * inv[y] % mo;
}
int ask(int n, int deg, int sz) {
  if (n == 1) return deg == 0 || deg == d - 1;
  if (sz == 0) return 0;
  int &ans = dp[n][deg][sz];
  if (ans != -1)
    return ans;
  else
    ans = 0;
  int tmp = ask(sz, d - 1, sz - 1);
  for (int p = 0, f = 1; p <= deg && sz * p <= n - 1; ++p) {
    inc(ans, ask(n - p * sz, deg - p, sz - 1) * qry(tmp, p) % mo);
  }
  return ans;
}
int main() {
  scanf("%d%d%d", &n, &d, &mo);
  if (n < 2) return puts("1"), 0;
  inv[1] = 1;
  for (int i = 2; i <= 15; i++) inv[i] = 1ll * (mo - mo / i) * inv[mo % i] % mo;
  inv[0] = 1;
  for (int i = 1; i <= 15; i++) inv[i] = 1ll * inv[i] * inv[i - 1] % mo;
  memset(dp, -1, sizeof(dp));
  int ans;
  if (n & 1)
    ans = ask(n, d, n / 2);
  else {
    ans = ask(n, d, n / 2 - 1);
    int tmp = ask(n / 2, d - 1, n / 2 - 1);
    inc(ans, qry(tmp, 2));
  }
  printf("%d\n", ans);
  return 0;
}