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 int N = 1e3 + 7;
const int D = 12;
int MOD;
int f[N][D], g[N];
int n, d, rev[N];
int power(int a, int n) {
  int ret = 1;
  for (int i = 1; i <= n; i <<= 1) {
    if (n & i) {
      ret = 1LL * ret * a % MOD;
    }
    a = 1LL * a * a % MOD;
  }
  return ret;
}
void add(int &a, int b) {
  if ((a += b) >= MOD) {
    a -= MOD;
  }
}
int comb(int n, int m) {
  assert(n <= MOD && m <= MOD);
  int ret = 1;
  for (int i = 1; i <= m; i++) {
    ret = 1LL * ret * ((n - i + 1 + MOD) % MOD) % MOD;
    ret = 1LL * ret * rev[i] % MOD;
  }
  return ret;
}
int main() {
  scanf("%d %d %d", &n, &d, &MOD);
  if (n <= 2) {
    printf("1\n");
    return 0;
  }
  rev[0] = 1;
  for (int i = 1; i <= d; i++) {
    rev[i] = power(i, MOD - 2) % MOD;
  }
  f[1][0] = 1;
  for (int i = 1; i <= n / 2; i++) {
    if (i == 1) {
      g[1] = 1;
    } else {
      g[i] = f[i][d - 1];
    }
    if (g[i] == 0) continue;
    if ((i - 1) % (d - 1) != 0) assert(g[i] == 0);
    for (int j = n; j >= 1; j--) {
      for (int k = 0; k <= d; k++) {
        if (f[j][k] == 0) {
          continue;
        }
        for (int l = 1; k + l <= d && j + l * i <= n; l++) {
          add(f[j + l * i][k + l], 1LL * f[j][k] * comb(g[i] + l - 1, l) % MOD);
        }
      }
    }
  }
  int ans = f[n][d];
  if (n % 2 == 0) {
    ans += MOD - comb(f[n / 2][d - 1], 2);
    ans %= MOD;
  }
  printf("%d\n", ans);
  return 0;
}