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 maxn = 1050;
const long long maxd = 11;
long long mod;
const long long inf = 1e9 + 500;
long long dp[maxn][maxd][maxn];
long long rev[15];
long long poww(long long a, long long b) {
  if (b == 0) {
    return 1;
  }
  long long v = poww(a, b / 2);
  v = (v * v) % mod;
  if (b & 1) {
    return (v * a) % mod;
  }
  return v;
}
long long ent(long long n, long long k) {
  if (n < k || k < 0) {
    return 0;
  }
  long long ans = 1;
  for (long long i = n; i > n - k; i--) {
    ans *= i;
    ans %= mod;
  }
  for (long long i = 2; i <= k; i++) {
    ans *= rev[i];
    ans %= mod;
  }
  return ans;
}
int main() {
  long long n, d;
  cin >> n >> d >> mod;
  for (long long i = 1; i < 15; i++) {
    rev[i] = poww(i, mod - 2);
  }
  if (n == 1) {
    cout << 1;
    return 0;
  }
  if (n == 2) {
    cout << 1;
    return 0;
  }
  dp[1][0][0] = 1;
  dp[2][1][1] = 1;
  for (long long x = 3; x <= n; x++) {
    dp[x][1][x - 1] = dp[x - 1][d - 1][x - 2];
    for (long long y = 2; y <= d; y++) {
      if ((x - y - 1) % (d - 1) != 0) {
        continue;
      }
      if (x - 1 == y) {
        dp[x][y][1] = 1;
      }
      for (long long z = 2; z <= x - 1; z++) {
        dp[x][y][z] += dp[x][y][z - 1];
        for (long long i = 1; i <= y && x > z * i; i++) {
          dp[x][y][z] += (dp[x - z * i][y - i][min(z - 1, x - z * i - 1)] *
                          ent(dp[z][d - 1][z - 1] + i - 1, i)) %
                         mod;
          dp[x][y][z] %= mod;
        }
      }
    }
  }
  for (long long i = 0; i <= n; i++) {
    for (long long j = 0; j <= d; j++) {
      for (long long k = 0; k <= n; k++) {
        if (dp[i][j][k] > 0) {
        }
      }
    }
  }
  long long ans = 0;
  if (n % 2 == 0) {
    ans += dp[n][d][n / 2 - 1];
    long long res = dp[n / 2][d - 1][n / 2 - 1];
    res += ((res * (res - 1) / 2) % mod);
    res %= mod;
    ans += res;
    ans %= mod;
    cout << ans << endl;
  } else {
    cout << dp[n][d][n / 2];
  }
}