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;
long long read() {
  char c = getchar();
  long long flag = 1, ans = 0;
  while (c < '0' || c > '9') {
    if (c == '-') flag = -flag;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ans = ans * 10 + c - '0';
    c = getchar();
  }
  return ans * flag;
}
const long long MAXN = 1005;
long long dp[MAXN][12][MAXN], inv[MAXN], fac[MAXN];
long long n, d, mod;
inline long long add(long long a, long long b) {
  return (a + b >= mod) ? (a + b - mod) : (a + b);
}
inline long long sub(long long a, long long b) {
  return (a < b) ? (a + mod - b) : (a - b);
}
inline long long mul(long long a, long long b) { return a * b % mod; }
long long qpow(long long b, long long k) {
  long long ans = 1;
  while (k) {
    if (k & 1) ans = mul(ans, b);
    b = mul(b, b);
    k >>= 1;
  }
  return ans;
}
void init() {
  fac[0] = 1;
  for (long long i = 1; i <= n; ++i) fac[i] = mul(fac[i - 1], i);
  inv[n] = qpow(fac[n], mod - 2);
  for (long long i = n - 1; i + 1; --i) inv[i] = mul(inv[i + 1], i + 1);
}
long long C(long long n, long long m) {
  if (n < 0 || m < 0 || n < m) return 0;
  long long ans = 1;
  for (long long i = 0; i < m; ++i) ans = mul(ans, (n - i));
  return mul(ans, inv[m]);
}
int main() {
  n = read(), d = read(), mod = read();
  if (n <= 2) {
    puts("1");
    return 0;
  }
  init();
  for (long long i = 0; i <= n; ++i) dp[1][0][i] = 1ll;
  for (long long i = 2; i <= n; ++i)
    for (long long j = 1; j <= min(d, i - 1); ++j)
      for (long long k = 1; k <= n; ++k) {
        dp[i][j][k] = dp[i][j][k - 1];
        for (long long t = 1; t <= j && t * k <= i; ++t)
          dp[i][j][k] =
              add(dp[i][j][k],
                  mul(C(dp[k][(k > 1) ? (d - 1) : 0][k - 1] + t - 1, t),
                      dp[i - t * k][j - t][k - 1]));
      }
  long long ans = dp[n][d][n / 2];
  if (!(n & 1)) ans = sub(ans, C(dp[n / 2][d - 1][n / 2 - 1], 2));
  printf("%lld\n", ans);
  return 0;
}