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;
inline void rd(int &x) {
  char ch;
  x = 0;
  bool fl = false;
  while (!isdigit(ch = getchar())) (ch == '-') && (fl = true);
  for (x = (ch ^ '0'); isdigit(ch = getchar()); x = x * 10 + (ch ^ '0'))
    ;
  (fl == true) && (x = -x);
}
namespace Miracle {
const int N = 1005;
int mod, n, d;
int f[N][11][N];
int jie[11], inv[11];
int qm(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = (long long)ret * x % mod;
    x = (long long)x * x % mod;
    y >>= 1;
  }
  return ret;
}
int dp(int i, int j, int k) {
  if (f[i][j][k] != -1) return f[i][j][k];
  if (i == 1) {
    if (j == d - 1 || !j) return f[i][j][k] = 1;
    return f[i][j][k] = 0;
  }
  if (i == 0) {
    if (k == 0 && j == 0)
      return f[i][j][k] = 1;
    else
      return f[i][j][k] = 0;
  }
  if (j > i - 1) return f[i][j][k] = 0;
  if (i > 1 && k == 0) return f[i][j][k] = 0;
  int C = 1;
  int ret = 0;
  int tmp = dp(k, d - 1, k - 1);
  for (register int m = 0; m <= j && m * k <= i - 1; ++m) {
    ret = (ret +
           (long long)dp(i - m * k, j - m, k - 1) * C % mod * inv[m] % mod) %
          mod;
    C = (long long)C * (tmp - 1 + m + 1) % mod;
  }
  return f[i][j][k] = ret;
}
int main() {
  rd(n);
  rd(d);
  rd(mod);
  if (n <= 2) {
    puts("1");
    return 0;
  }
  memset(f, -1, sizeof f);
  jie[0] = 1;
  for (register int i = 1; i <= 10; ++i)
    jie[i] = (long long)jie[i - 1] * i % mod;
  inv[10] = qm(jie[10], mod - 2);
  for (register int i = 9; i >= 0; --i)
    inv[i] = (long long)inv[i + 1] * (i + 1) % mod;
  long long ans = 0;
  ans = (ans + dp(n, d, (n - 1) / 2));
  if (n % 2 == 0) {
    long long tmp = 0;
    tmp = dp(n / 2, d - 1, n / 2 - 1);
    ans = (ans + (tmp * (tmp + 1) / 2 % mod)) % mod;
  }
  printf("%I64d", ans);
  return 0;
}
}  // namespace Miracle
signed main() {
  Miracle::main();
  return 0;
}