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;
char c;
inline void read(long long& a) {
  a = 0;
  do c = getchar();
  while (c < '0' || c > '9');
  while (c <= '9' && c >= '0') a = (a << 3) + (a << 1) + c - '0', c = getchar();
}
long long n, d, Mod, F[1001], G[11][1001], Rev[10];
inline long long C(long long x, long long y) {
  long long r = Rev[y];
  for (long long i = x; i < x + y; i++) r = r * i % Mod;
  return r;
}
int main() {
  read(n), read(d), read(Mod);
  if (n == 1) return puts("1"), 0;
  if ((n - 2) % (d - 1)) return puts("0"), 0;
  n = (n - 2) / (d - 1);
  Rev[0] = Rev[1] = 1;
  for (int i = 2; i <= d; i++) Rev[i] = (Mod - Mod / i) * Rev[Mod % i] % Mod;
  for (int i = 2; i <= d; i++) Rev[i] = Rev[i] * Rev[i - 1] % Mod;
  F[0] = 1;
  for (int i = 0; i <= d; i++) G[i][0] = 1;
  for (int i = 1; i <= n >> 1; i++) {
    F[i] = G[d - 1][i - 1];
    if (i + i < n)
      for (int j = d; j; j--)
        for (int l = i; l <= n; l++)
          for (int k = 1; k <= j && i * k <= l; k++)
            G[j][l] = (G[j][l] + G[j - k][l - i * k] * C(F[i], k)) % Mod;
  }
  cout << (G[d][n - 1] + (n & 1 ? 0 : C(F[n >> 1], 2))) % Mod << endl;
  return 0;
}