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 + 10;
const int D = 11;
int mod;
long long mul(long long a, long long b) { return (a * b) % mod; }
long long bin_pow(long long b, long long p) {
  long long res = 1;
  for (long long j = 1, pw = b; j <= p; j <<= 1, pw = mul(pw, pw))
    if (p & j) res = mul(res, pw);
  return res;
}
long long inv(long long x) { return bin_pow(x, mod - 2); }
long long nCr(long long n, long long r) {
  long long res = 1;
  for (int i = 0; i < r; i++) {
    res = mul(res, mul(n - i, inv(i + 1)));
  }
  return res;
}
long long dp[N][N][D];
long long ct[N][D];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, d;
  cin >> n >> d >> mod;
  if (n <= 2) return cout << "1\n", 0;
  fill(ct[1], ct[1] + D, 1);
  for (int i = 0; i < N; i++) dp[1][i][0] = 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 0; k <= d; k++) {
        dp[i][j][k] = dp[i][j - 1][k];
        for (int cnt = 1; cnt <= k && cnt * j < i; cnt++) {
          dp[i][j][k] += dp[i - cnt * j][j - 1][k - cnt] * ct[j][cnt];
          dp[i][j][k] %= mod;
        }
      }
    }
    ct[i][0] = 1;
    ct[i][1] = dp[i][i - 1][d - 1];
    for (int j = 2; j <= d; j++) {
      ct[i][j] = nCr(ct[i][1] + j - 1, j);
    }
  }
  long long ans = dp[n][(n - 1) / 2][d];
  if (n % 2 == 0) {
    long long x = dp[n / 2][(n / 2) - 1][d - 1];
    ans += x;
    ans += mul(mul(x, x - 1), inv(2));
  }
  cout << ans % mod << '\n';
  return 0;
}