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, m, MOD;
int f[1010][11];
int ans[1010];
int s[11];
int mo(int x) {
  if (x >= MOD) return x - MOD;
  return x;
}
int power(int x, int y) {
  int ans = 1, t = x;
  while (y) {
    if (y % 2) ans = 1ll * ans * t % MOD;
    t = 1ll * t * t % MOD;
    y /= 2;
  }
  return ans;
}
int C(int x, int y) {
  int sum = 1;
  for (int i = 1; i <= y; i++)
    sum = 1ll * sum * (x - i + 1) % MOD * power(i, MOD - 2) % MOD;
  return sum;
}
int main() {
  scanf("%d%d%d", &n, &m, &MOD);
  if (n == 2) {
    printf("1\n");
    return 0;
  }
  ans[1] = 1;
  f[0][0] = 1;
  for (int i = 1; i < n; i++) {
    if (i <= (n - 1) / 2) {
      for (int j = 1; j <= m; j++) s[j] = C(ans[i] + j - 1, j);
      for (int w = m; w; w--)
        for (int j = w; j; j--)
          for (int k = 0; k <= n - j * i; k++)
            f[k + j * i][w] =
                mo(f[k + j * i][w] + 1ll * f[k][w - j] * s[j] % MOD);
    }
    if (n % 2 == 0 && i == n / 2) {
      for (int j = 1; j <= m; j++)
        s[j] = 1ll * C(ans[i] + j - 1, j) * power(2, MOD - 2) % MOD;
      for (int w = m; w; w--)
        for (int j = w; j; j--)
          for (int k = 0; k <= n - j * i; k++)
            f[k + j * i][w] =
                mo(f[k + j * i][w] + 1ll * f[k][w - j] * s[j] % MOD);
    }
    if (i == n - 1)
      ans[i + 1] = f[i][m];
    else
      ans[i + 1] = f[i][m - 1];
  }
  if (n % 2 == 0)
    ans[n] = mo(ans[n] + 1ll * ans[n / 2] * power(2, MOD - 2) % MOD);
  printf("%d\n", ans[n]);
}