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>
namespace my_std {
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
inline T rnd(T l, T r) {
  return uniform_int_distribution<T>(l, r)(rng);
}
template <typename T>
inline void read(T& t) {
  t = 0;
  char f = 0, ch = getchar();
  double d = 0.1;
  while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
  while (ch <= '9' && ch >= '0') t = t * 10 + ch - 48, ch = getchar();
  if (ch == '.') {
    ch = getchar();
    while (ch <= '9' && ch >= '0') t += d * (ch ^ 48), d *= 0.1, ch = getchar();
  }
  t = (f ? -t : t);
}
template <typename T, typename... Args>
inline void read(T& t, Args&... args) {
  read(t);
  read(args...);
}
void file() {}
}  // namespace my_std
using namespace my_std;
int n, d;
long long mod;
long long dp[1010][15][1010];
long long inv[15];
long long dfs(int i, int j, int k) {
  k = min(k, n - 1);
  if (dp[i][j][k] != -1) return dp[i][j][k];
  if (i == 1) return j == 0 || j == d - 1;
  if (!k) return 0;
  long long ret = dfs(i, j, k - 1), s = dfs(k, d - 1, k - 1), cur = 1;
  for (int t = (1); t <= (j); t++) {
    if (t * k >= i) break;
    long long c = dfs(i - t * k, j - t, k - 1);
    cur = cur * (s + t - 1) % mod * inv[t] % mod;
    ret = (ret + c * cur % mod) % mod;
  }
  return dp[i][j][k] = ret;
}
int main() {
  file();
  read(n, d, mod);
  if (n <= 2) return puts("1"), 0;
  inv[1] = 1;
  for (int i = (2); i <= (d); i++)
    inv[i] = 1ll * (mod - mod / i) * inv[mod % i] % mod;
  memset(dp, -1, sizeof(dp));
  long long ans = dfs(n, d, n / 2);
  if (n % 2 == 0) {
    long long s = dfs(n / 2, d - 1, n / 2 - 1);
    ans = (ans - (s * (s - 1) / 2) % mod + mod) % mod;
  }
  cout << ans;
}