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>
#pragma GCC optimize("Ofast")
using namespace std;
const long double eps = 1e-7;
const int inf = 1000000010;
const long long INF = 10000000000000010LL;
const int MAXN = 1110, LOG = 20;
long long n, m, k, d, x, y, t, a, b, mod;
long long dp[MAXN][MAXN][11];
long long F[MAXN];
long long I[MAXN];
long long inv[MAXN];
long long powmod(long long a, long long b) {
  if (!b) return 1;
  if (b & 1) return a * powmod(a * a % mod, b >> 1) % mod;
  return powmod(a * a % mod, b >> 1);
}
long long C(long long n, long long r) {
  if (r > n || r < 0) return 0;
  if (n < MAXN) return (F[n] * I[r] % mod) * I[n - r] % mod;
  long long res = 1;
  r = min(r, n - r);
  for (int i = 1; i <= r; i++) res = res * ((n - i + 1) * inv[i] % mod) % mod;
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> d >> mod;
  if (n <= 2 || d == 2) return cout << 1 << '\n', 0;
  F[0] = inv[0] = 1;
  for (int i = 1; i < MAXN; i++) F[i] = F[i - 1] * i % mod;
  I[MAXN - 1] = powmod(F[MAXN - 1], mod - 2);
  for (int i = MAXN - 1; i; i--) I[i - 1] = I[i] * i % mod;
  for (int i = 1; i < MAXN - 1; i++) inv[i] = I[i] * F[i - 1] % mod;
  for (int i = 0; i <= n; i++) dp[0][i][0] = dp[1][i][0] = dp[1][i][d - 1] = 1;
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= n; j++)
      for (int k = 1; k <= d; k++) {
        dp[i][j][k] = dp[i][j - 1][k];
        for (int t = 1; t <= k; t++)
          if (i - t * j > 0)
            dp[i][j][k] += dp[i - t * j][j - 1][k - t] *
                           C(dp[j][n / 2][d - 1] + t - 1, t) % mod;
        dp[i][j][k] %= mod;
      }
  long long ans = dp[n][n / 2 - 1][d];
  if (n % 2 == 0) ans = (ans + C(dp[n / 2][n / 2][d - 1] + 1, 2)) % mod;
  cout << ans << '\n';
  return 0;
}