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 mod;
void sadd(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int add(int a, int b) {
  sadd(a, b);
  return a;
}
int mul(int a, int b) { return (a * 1LL * b) % mod; }
void smul(int &a, int b) { a = mul(a, b); }
int fpow(int x, int n) {
  if (n == 0) return 1;
  int a = fpow(x, n >> 1);
  smul(a, a);
  if (n & 1) smul(a, x);
  return a;
}
int rev(int x) { return fpow(x, mod - 2); }
int _div(int a, int b) { return mul(a, rev(b)); }
void sdiv(int &a, int b) { smul(a, rev(b)); }
const int N = 1005;
const int D = 11;
int n, d;
int dpTree[N][D];
int dpForestEq[D][N];
int dpForest[N][D][N];
int getTree(int v, int rd);
int getForest(int vs, int rs, int md);
int getForestEq(int cnt, int vone);
int C(int a, int b) {
  int ans = 1;
  for (int i = 0; i < b; i++) {
    smul(ans, (a - i + mod) % mod);
    sdiv(ans, i + 1);
  }
  42;
  return ans;
}
int place(int cnt, int diff) { return C(cnt - 1, diff - 1); }
int getSplit(int k, int cnt) {
  if (cnt == 0) return 1;
  int ans = 0;
  for (int diff = 1; diff <= min(cnt, k); diff++)
    sadd(ans, mul(C(k, diff), place(cnt, diff)));
  42;
  return ans;
}
int getForestEq(int cnt, int vone) {
  42;
  int &ans = dpForestEq[cnt][vone];
  if (ans != -1) return ans;
  if (vone <= 0) return ans = 0;
  int k = ((cnt == 0) ? 1 : getTree(vone, d - 1));
  ans = getSplit(k, cnt);
  42;
  return ans;
}
int getForest(int vs, int rs, int md) {
  42;
  int &ans = dpForest[vs][rs][md];
  if (ans != -1) return ans;
  if (vs == 0 && rs == 0) return 1;
  if (md == 0) return 0;
  if (rs > vs) return 0;
  if (rs * md < vs) return 0;
  int curans = 0;
  for (int cnt = 0; cnt * md <= vs && cnt <= rs; cnt++) {
    sadd(curans,
         mul(getForest(vs - cnt * md, rs - cnt, md - 1), getForestEq(cnt, md)));
  }
  42;
  return ans = curans;
}
int getTree(int vs, int rd) {
  42;
  int &ans = dpTree[vs][rd];
  if (ans != -1) return ans;
  if (vs == 0) return 0;
  ans = getForest(vs - 1, rd, (n - 1) / 2);
  42;
  return ans;
}
int main(int, char **) {
  memset(dpForest, -1, sizeof dpForest);
  memset(dpForestEq, -1, sizeof dpForestEq);
  memset(dpTree, -1, sizeof dpTree);
  scanf("%d%d%d", &n, &d, &mod);
  dpTree[1][d] = 1;
  dpTree[1][d - 1] = 1;
  int ans = 0;
  sadd(ans, getTree(n, d));
  if (n % 2 == 0) sadd(ans, getForestEq(2, n / 2));
  printf("%d\n", ans);
  return 0;
}