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>
int md;
int vv[10 + 1];
void init() {
  int i;
  for (i = 1; i <= 10; i++)
    vv[i] = i == 1 ? 1 : (long long)vv[i - md % i] * (md / i + 1) % md;
}
int main() {
  static int dp[1000 + 1], dq[1000 + 1];
  int n, d, i, j, k, ans;
  scanf("%d%d%d", &n, &d, &md), init();
  if (n == 1 || d == 2) {
    printf("1\n");
    return 0;
  }
  if ((n - 1) % (d - 1) != 1) {
    printf("0\n");
    return 0;
  }
  dp[1] = 1, dq[1] = 1;
  for (i = 1; i * 2 < n; i++) {
    int x = dp[i];
    if (i % (d - 1) != 1 || x == 0) continue;
    for (j = n / 2 - 1; j > 0; j--) {
      int y = dp[j], z = 1, k_ = (j - 2) % (d - 1) + 1;
      for (k = 1; (j + i * k) * 2 <= n && k_ + k < d && z != 0; k++) {
        z = (long long)z * (x + k - 1) % md * vv[k] % md;
        dp[j + i * k] = (dp[j + i * k] + (long long)y * z) % md;
      }
    }
    for (j = n - 1; j > 0; j--) {
      int y = dq[j], z = 1, k_ = (j - 2) % (d - 1) + 1;
      for (k = 1; j + i * k <= n &&
                  (k_ + k < d || k_ + k == d && j + i * k == n) && z != 0;
           k++) {
        z = (long long)z * (x + k - 1) % md * vv[k] % md;
        dq[j + i * k] = (dq[j + i * k] + (long long)y * z) % md;
      }
    }
  }
  ans = dq[n];
  if (n % 2 == 0 && n / 2 % (d - 1) == 1)
    ans = (ans + (long long)dp[n / 2] * (dp[n / 2] + 1) % md * vv[2]) % md;
  printf("%d\n", ans);
  return 0;
}