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>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
mt19937 ggen;
int MOD;
inline int add(int a, int b, int m = MOD) {
  int res = a + b;
  if (res >= m) res -= m;
  return res;
}
inline int sub(int a, int b, int m = MOD) {
  int res = a - b;
  if (res < 0) res += m;
  return res;
}
inline int mul(int a, int b, int m = MOD) { return ((long long)(a)*b) % m; }
inline int binpow(int a, int p, int m = MOD) {
  if (m == 1) return 0;
  int res = 1;
  while (p) {
    if (p & 1) res = mul(res, a, m);
    a = mul(a, a, m);
    p >>= 1;
  }
  return res;
}
inline int obr(int a, int m = MOD) { return binpow(a, m - 2, m); }
int fact[1010];
int rfact[1010];
void precalc() {
  fact[0] = rfact[0] = 1;
  for (int i = 1; i < 1010; i++) {
    fact[i] = mul(fact[i - 1], i);
    rfact[i] = obr(fact[i]);
  }
}
inline int comb(int n, int k) {
  int res = rfact[k];
  for (int i = 0; i < k; i++) {
    res = mul(res, n);
    n--;
  }
  return res;
}
int n, d;
int f[1010][11][1010];
int dyn(int sz, int pw, int ms) {
  if (pw == 0) {
    return sz == 1;
  }
  if (ms == 0) return 0;
  if (ms == 1) return (sz - 1 == pw);
  if (f[sz][pw][ms] != -1) return f[sz][pw][ms];
  int res = dyn(sz, pw, ms - 1);
  int tt = dyn(ms, d - 1, ms - 1);
  for (int i = 1; i <= pw && sz > i * ms && tt; i++) {
    int tres = dyn(sz - i * ms, pw - i, ms - 1);
    res = add(res, mul(tres, comb(tt + i - 1, i)));
  }
  return f[sz][pw][ms] = res;
}
void solve() {
  cin >> n >> d >> MOD;
  precalc();
  if (n <= 2) {
    cout << 1;
    return;
  }
  memset(f, -1, sizeof f);
  int res = dyn(n, d, (n - 1) / 2);
  if ((n & 1) == 0) {
    res = add(res, comb(dyn(n / 2, d - 1, n / 2 - 1) + 1, 2));
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ggen = mt19937(13);
  solve();
  return 0;
}