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, inv[15], f[1005], comp[1005][15], dp[1005][15][1005],
    g[1005][15];
inline void ch(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
inline int sel(int k, int u) {
  if (~comp[k][u]) return comp[k][u];
  int &ans = comp[k][u];
  ans = 1;
  k = f[k];
  for (int i = 1; i <= u; i++) ans = (long long)ans * inv[i] % mod;
  for (int i = k + u - 1; i >= k; i--) ans = (long long)ans * i % mod;
  return ans;
}
inline int exp(int x, int y) {
  int ans = 1;
  while (y) {
    if (y & 1) ans = (long long)ans * x % mod;
    x = (long long)x * x % mod;
    y >>= 1;
  }
  return ans;
}
void solve(int n) {
  memset(comp, -1, sizeof(comp));
  f[1] = 1;
  dp[1][0][0] = 1;
  for (int k = 1; k <= n; k += d) {
    int typ = (k - 1) / d + 1;
    dp[1][0][typ] = 1;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= d + 1; j++)
      for (int k = 1; k <= n; k += d) {
        int typ = (k - 1) / d + 1;
        for (int u = 0; u <= j && u * k < i; u++)
          ch(dp[i][j][typ],
             (long long)dp[i - u * k][j - u][typ - 1] * sel(k, u) % mod);
      }
    if ((i - 1) % d == 0) f[i] = dp[i][d][(n - 1) / d];
  }
}
int main() {
  scanf("%d%d%d", &n, &d, &mod);
  if (n == 1) {
    puts("1");
    return 0;
  }
  for (int i = 1; i <= d; i++) inv[i] = exp(i, mod - 2);
  d--;
  solve(n / 2);
  int ans = 0;
  if (n % 2 == 0) ch(ans, sel(n / 2, 2));
  g[1][0] = 1;
  for (int i = 1; i <= (n - 1) / 2; i++) {
    if ((i - 1) % d != 0) continue;
    for (int j = n; j > 1; j--)
      for (int k = d + 1; ~k; k--)
        for (int u = 1; u <= k && u * i <= j; u++)
          ch(g[j][k], (long long)g[j - u * i][k - u] * sel(i, u) % mod);
  }
  ch(ans, g[n][d + 1]);
  printf("%d\n", ans);
  return 0;
}