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;
long long int modulo;
int n2;
long long int eleva(long long int b, long long int e) {
  if (e == 0) return 1;
  if (e % 2 == 0) return eleva(b * b % modulo, e / 2);
  return b * eleva(b * b % modulo, e / 2) % modulo;
}
long long int inverso(long long int x) { return eleva(x, modulo - 2); }
void anyade(long long int &a, long long int b) { a = (a + b) % modulo; }
bool puede(int n) {
  if (n == 0) return false;
  return (n - 1) % (d - 1) == 0;
}
long long int elecciones(int n, int ndown, int a);
long long int memmaner[1001];
int calcul[1001];
long long int maner(int n) {
  if (n == 1) return 1;
  long long int &mem = memmaner[n];
  if (calcul[n]) return mem;
  calcul[n] = 1;
  mem = elecciones(n - 1, n - 1, d - 1);
  return mem;
}
long long int memcombi[1001][11];
long long int calccombi[1001][11];
long long int combi(int n, int a) {
  long long int &mem = memcombi[n][a];
  if (calccombi[n][a]) return mem;
  calccombi[n][a] = 1;
  if (a == 0) {
    mem = 1;
    return mem;
  }
  if (not puede(n)) return mem;
  long long int man = maner(n) - 1 + a;
  long long int num = 1;
  long long int div = 1;
  for (int i = 1; i <= a; i++) {
    num = num * (man - i + 1) % modulo;
    div = div * i % modulo;
  }
  mem = num * inverso(div) % modulo;
  return mem;
}
long long int memelecciones[1001][1001][11];
int calcelec[1001][1001][11];
long long int elecciones(int n, int ndown, int a) {
  if (a == 0) return n == 0;
  if (n == 0 or ndown == 0) return 0;
  long long int &mem = memelecciones[n][ndown][a];
  if (calcelec[n][ndown][a]) return mem;
  calcelec[n][ndown][a] = 1;
  for (int aa = 0, suma = 0; aa <= a and suma <= n; aa++, suma += ndown)
    anyade(mem, combi(ndown, aa) *
                    elecciones(n - suma, min(n - suma, ndown - 1), a - aa));
  return mem;
}
int main() {
  cin >> n >> d >> modulo;
  long long int sol = 0;
  if (n % 2 == 0) anyade(sol, combi(n / 2, 2));
  n2 = n / 2;
  if (2 * n2 == n) n2--;
  if (n == 1)
    anyade(sol, 1);
  else
    anyade(sol, elecciones(n - 1, n2, d));
  sol = ((sol % modulo) + modulo) % modulo;
  cout << sol << endl;
}