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;
inline int read() {
  char c = getchar();
  int x = 0;
  bool f = 0;
  for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45);
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  if (f) x = -x;
  return x;
}
int mod;
struct modint {
  int x;
  modint(int o = 0) { x = o; }
  modint &operator=(int o) { return x = o, *this; }
  modint &operator+=(modint o) {
    return x = x + o.x >= mod ? x + o.x - mod : x + o.x, *this;
  }
  modint &operator-=(modint o) {
    return x = x - o.x < 0 ? x - o.x + mod : x - o.x, *this;
  }
  modint &operator*=(modint o) { return x = 1ll * x * o.x % mod, *this; }
  modint &operator^=(int b) {
    modint a = *this, c = 1;
    for (; b; b >>= 1, a *= a)
      if (b & 1) c *= a;
    return x = c.x, *this;
  }
  modint &operator/=(modint o) { return *this *= o ^= mod - 2; }
  modint &operator+=(int o) {
    return x = x + o >= mod ? x + o - mod : x + o, *this;
  }
  modint &operator-=(int o) {
    return x = x - o < 0 ? x - o + mod : x - o, *this;
  }
  modint &operator*=(int o) { return x = 1ll * x * o % mod, *this; }
  modint &operator/=(int o) { return *this *= ((modint(o)) ^= mod - 2); }
  template <class I>
  friend modint operator+(modint a, I b) {
    return a += b;
  }
  template <class I>
  friend modint operator-(modint a, I b) {
    return a -= b;
  }
  template <class I>
  friend modint operator*(modint a, I b) {
    return a *= b;
  }
  template <class I>
  friend modint operator/(modint a, I b) {
    return a /= b;
  }
  friend modint operator^(modint a, int b) { return a ^= b; }
  friend bool operator==(modint a, int b) { return a.x == b; }
  friend bool operator!=(modint a, int b) { return a.x != b; }
  bool operator!() { return !x; }
  modint operator-() { return x ? mod - x : 0; }
};
modint fac[2005], inv[2005];
inline void prework(int n) {
  fac[0] = 1;
  for (register int i = (1); i <= (n); ++i) fac[i] = fac[i - 1] * i;
  inv[n] = modint(1) / fac[n];
  for (register int i = (n - 1); i >= (0); --i) inv[i] = inv[i + 1] * (i + 1);
}
inline modint C(modint n, int m) {
  if (m > n.x) return 0;
  modint res = 1;
  for (register int i = (n.x - m + 1); i <= (n.x); ++i) res *= i;
  return res * inv[m];
}
int n, d;
modint f[2005][13][2005];
signed main() {
  n = read(), d = read(), mod = read();
  if (n == 1 || n == 2) {
    puts("1");
    return 0;
  }
  prework(2000);
  for (register int i = (0); i <= (n); ++i) f[1][0][i] = 1;
  for (register int i = (2); i <= (n); ++i)
    for (register int j = (1); j <= (min(d, i - 1)); ++j)
      for (register int k = (1); k <= (n); ++k) {
        f[i][j][k] = f[i][j][k - 1];
        for (register int t = (1); t <= (j); ++t) {
          if (i >= t * k && k >= 1) {
            if (k > 1)
              f[i][j][k] +=
                  f[i - t * k][j - t][k - 1] * C(f[k][d - 1][k - 1] + t - 1, t);
            else
              f[i][j][k] +=
                  f[i - t * k][j - t][k - 1] * C(f[k][0][k - 1] + t - 1, t);
          }
        }
      }
  if (n & 1)
    cout << f[n][d][n / 2].x;
  else
    cout << (f[n][d][n / 2] - C(f[n / 2][d - 1][n / 2 - 1], 2)).x;
  return 0;
}