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>
const int kN = 1000 + 5;
int n, d, mod;
int f[kN][10 + 1][kN];
int g[kN];
inline void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
void exgcd(int a, int b, int &g, int &x, int &y) {
  if (b == 0)
    g = a, x = 1, y = 0;
  else {
    exgcd(b, a % b, g, y, x);
    y -= x * (a / b);
  }
}
int inv(int w) {
  int g, x, y;
  exgcd(w, mod, g, x, y);
  return (x % mod + mod) % mod;
}
int Inv[10 + 1];
int work() {
  if (n == 1) return 1;
  if (n == 2) return 1;
  for (int i = 1; i <= 10; ++i) Inv[i] = inv(i);
  f[0][0][0] = 1;
  g[1] = 1;
  for (int j = 0; j + 1 <= n / 2; ++j) {
    for (int cnt = 0; cnt <= d; ++cnt) {
      for (int i = 0; i < n; ++i) {
        if (f[j][cnt][i] == 0) continue;
        int binom = 1;
        add(f[j + 1][cnt][i], f[j][cnt][i]);
        for (int k = 1; cnt + k <= d && i + (j + 1) * k < n; ++k) {
          binom = binom * 1ll * (g[j + 1] + k - 1) % mod * Inv[k] % mod;
          add(f[j + 1][cnt + k][i + (j + 1) * k],
              f[j][cnt][i] * 1ll * binom % mod);
        }
      }
    }
    g[j + 2] = f[j + 1][d - 1][j + 1];
  }
  int ret = f[n / 2][d][n - 1];
  if (n % 2 == 0) {
    add(ret, mod - f[n / 2][d - 1][n / 2 - 1] * 1ll *
                       (f[n / 2][d - 1][n / 2 - 1] + mod - 1) % mod * Inv[2] %
                       mod);
  }
  return ret;
}
int main() {
  scanf("%d%d%d", &n, &d, &mod);
  printf("%d\n", work());
}