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;
const long long inf = 1ll << 50;
const int maxn = 1005;
const int maxd = 15;
int n, d;
long long f[maxn], inc[maxn];
long long mod, g[maxn][maxn][maxd];
long long QuickPow(long long p, long long k) {
  long long res = 1ll;
  p %= mod;
  for (; k; k >>= 1, (p *= p) %= mod)
    if (k & 1) (res *= p) %= mod;
  return res;
}
int main() {
  scanf("%d %d %lld", &n, &d, &mod);
  if (n <= 2) {
    puts("1");
    return 0;
  }
  for (int i = 1; i <= n; i++) inc[i] = QuickPow(i, mod - 2);
  f[1] = g[0][0][0] = 1ll;
  for (int i = 0; i <= d; i++) g[1][i][i] = 1ll;
  for (int i = 2; i <= n / 2; i++) {
    f[i] = g[i - 1][i - 1][d - 1];
    for (int k = 0; k <= d; k++)
      for (int j = 0; j <= n; j++)
        if (g[i - 1][j][k]) {
          long long cur = g[i - 1][j][k];
          for (int l = 0; j + l * i <= n && l + k <= d; l++) {
            (g[i][j + l * i][l + k] += cur) %= mod;
            (cur *= (f[i] + l) * inc[l + 1] % mod) %= mod;
          }
        }
  }
  if (n & 1)
    printf("%lld", g[n / 2][n - 1][d]);
  else {
    long long ans = g[n / 2 - 1][n - 1][d], cur = f[n / 2];
    (ans += (cur + 1) * cur % mod * inc[2]) %= mod;
    printf("%lld", ans);
  }
  return 0;
}