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 n, d, p;
long long fac[1005], ifac[1005];
long long f[1005][15][1005];
inline long long fastPow(long long a, long long b) {
  long long ans = 1;
  for (; b; b >>= 1, a = a * a % p)
    if (b & 1) ans = ans * a % p;
  return ans;
}
inline long long C(long long x, long long y) {
  if (x < y) return 0;
  long long ans = 1;
  for (long long i = x; i >= x - y + 1; i--) ans = ans * i % p;
  return ans * ifac[y] % p;
}
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
    if (ch == -1) return 0;
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
signed main() {
  n = read(), d = read(), p = read(), fac[0] = ifac[0] = 1;
  if (n <= 2) {
    puts("1");
    return 0;
  }
  for (long long i = 1; i <= d; i++)
    fac[i] = fac[i - 1] * i % p, ifac[i] = fastPow(fac[i], p - 2);
  for (long long i = 0; i <= n; i++) f[1][0][i] = 1;
  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++) {
        f[i][j][k] = f[i][j][k - 1];
        for (long long l = 1; l <= j; l++)
          if (i - k * l >= 0 && j - l >= 0 && k - 1 >= 0)
            if (k > 1)
              f[i][j][k] =
                  (f[i][j][k] + f[i - k * l][j - l][k - 1] *
                                    C(f[k][d - 1][k - 1] + l - 1, l) % p) %
                  p;
            else
              f[i][j][k] = (f[i][j][k] + f[i - k * l][j - l][k - 1] *
                                             C(f[k][0][k - 1] + l - 1, l) % p) %
                           p;
      }
  cout << ((n & 1)
               ? f[n][d][n / 2]
               : (f[n][d][n / 2] - C(f[n / 2][d - 1][n / 2 - 1], 2) + p) % p)
       << endl;
  return 0;
}