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;
int n, d, mod, f[1025][1025][11];
int inv[1025], v[1025];
long long power(long long a, long long b) {
  if (!b) return 1;
  if (b & 1) return power(a, b ^ 1) * a % mod;
  long long t = power(a, b >> 1);
  return t * t % mod;
}
inline void update(int& a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int main() {
  cin >> n >> d >> mod;
  if (n <= 2)
    cout << 1 << endl;
  else {
    for (register int i = 1; i <= 1000; i++) inv[i] = power(i, mod - 2);
    v[1] = f[0][0][0] = 1;
    for (register int i = 0; i <= d; i++) f[1][i][i] = 1;
    for (register int i = 2; i * 2 <= n; i++) {
      v[i] = f[i - 1][i - 1][d - 1];
      for (register int j = 0; j <= d; j++)
        for (register int k = 0; k <= n; k++)
          if (f[i - 1][k][j]) {
            int res = f[i - 1][k][j];
            for (int x = 0; res && x * i <= n - k && x <= d - j; x++) {
              update(f[i][k + x * i][x + j], res);
              res = res * 1ll * (v[i] + x) % mod * inv[x + 1] % mod;
            }
          }
    }
    if (n & 1)
      cout << f[n >> 1][n - 1][d] << endl;
    else
      cout << (f[(n >> 1) - 1][n - 1][d] +
               1ll * (v[n >> 1] + 1) * v[n >> 1] % mod * inv[2] % mod) %
                  mod
           << endl;
  }
}