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;
template <typename T>
void read(T &x) {
  x = 0;
  bool f = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = 1;
  for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
  if (f) x = -x;
}
template <typename F>
inline void write(F x, char ed = '\n') {
  static short st[30];
  short tp = 0;
  if (x < 0) putchar('-'), x = -x;
  do st[++tp] = x % 10, x /= 10;
  while (x);
  while (tp) putchar('0' | st[tp--]);
  putchar(ed);
}
template <typename T>
inline void Mx(T &x, T y) {
  x < y && (x = y);
}
template <typename T>
inline void Mn(T &x, T y) {
  x > y && (x = y);
}
const int N = 1050;
int n, d, P;
long long inv[N], dp[N];
long long C(long long n, int m) {
  long long res = inv[m];
  while (m) res = res * n % P, --n, --m;
  return res;
}
long long f[12][N][N];
int main() {
  read(n), read(d), read(P);
  if (n == 1 || n == 2) return write(1), 0;
  inv[0] = inv[1] = dp[1] = 1;
  for (int i = 2; i <= d; i++) inv[i] = (P - P / i) * inv[P % i] % P;
  for (int i = 2; i <= d; i++) inv[i] = inv[i - 1] * inv[i] % P;
  for (int i = 0; i <= n; i++) f[0][1][i] = 1;
  for (int i = 2; i <= n; i++) {
    int lim = min(d, i - 1);
    for (int j = 1; j <= lim; j++) {
      f[j][i][1] = i == j + 1;
      for (int k = 2; k + k <= n; k++) {
        f[j][i][k] = f[j][i][k - 1];
        for (int t = 1; t <= j && t * k < i; t++)
          f[j][i][k] = (f[j][i][k] +
                        f[j - t][i - t * k][k - 1] * C(dp[k] + t - 1, t) % P) %
                       P;
      }
    }
    dp[i] = f[d - 1][i][i - 1];
  }
  long long ans = 0;
  if (n & 1)
    ans = f[d][n][n / 2];
  else
    ans = (f[d][n][n / 2 - 1] + C(dp[n / 2] + 1, 2)) % P;
  write(ans);
  return 0;
}