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 GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
using namespace std;
namespace ywy {
int p;
unsigned char bv[1001][1001][11];
long long f[1001][1001][11];
int d;
inline long long mi(int a, int b) {
  long long ans = 1, tmp = a;
  while (b) {
    if (b & 1) ans = (ans * tmp) % p;
    tmp = (tmp * tmp) % p;
    b >>= 1;
  }
  return (ans);
}
long long ny[1001];
long long dp(int sz, int mx, int dk) {
  if (bv[sz][mx][dk]) return (f[sz][mx][dk]);
  bv[sz][mx][dk] = 1;
  if (sz == 1) {
    return (f[sz][mx][dk] = (dk == 0));
  }
  if (!dk || !mx || dk >= sz) return (f[sz][mx][dk] = 0);
  if (mx == 1) {
    return (f[sz][mx][dk] = (sz == dk + 1));
  }
  long long ans = dp(sz, mx - 1, dk);
  long long h = dp(mx, mx, d - 1);
  if (!h) return (f[sz][mx][dk] = ans);
  long long ji = 1;
  for (register int i = 1; i <= dk && i * mx < sz; i++) {
    ji *= ny[i];
    ji %= p;
    ji *= (h + i - 1);
    ji %= p;
    ans = (ans + dp(sz - i * mx, mx - 1, dk - i) * ji) % p;
  }
  return (f[sz][mx][dk] = ans);
}
void ywymain() {
  int n;
  cin >> n >> d >> p;
  for (register int i = 1; i <= d; i++) ny[i] = mi(i, p - 2);
  if (n <= 2) {
    cout << 1 << endl;
    return;
  }
  if (n & 1) {
    cout << dp(n, n / 2, d) << endl;
    return;
  }
  long long cjr = dp(n / 2, n / 2 - 1, d - 1);
  cjr = ((cjr + 1) * cjr) / 2;
  cjr %= p;
  cjr %= p;
  cjr += dp(n, n / 2 - 1, d);
  cjr %= p;
  cout << cjr << endl;
}
}  // namespace ywy
signed main() {
  ywy::ywymain();
  return (0);
}