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, p, dp[1003][13][1003], jc[13], iv[13];
bool ok[1003][13][1003];
inline int qpow(int x, int y) {
  int z = 1;
  for (; y; y >>= 1, x = (long long)x * x % p)
    if (y & 1) z = (long long)z * x % p;
  return z;
}
inline int cbn(int x, int y) {
  int z = 1;
  for (register int i = x - y + 1; i <= x; ++i) z = (long long)z * i % p;
  return z = (long long)z * iv[y] % p;
}
int dfs(int a, int b, int c) {
  if (a == 1) return b == d - 1 || b == 0;
  if (b == 0) return 0;
  if (c == 0) return 0;
  if (ok[a][b][c]) return dp[a][b][c];
  int res = dfs(a, b, c - 1), x = dfs(c, d - 1, c - 1), y = 1;
  ok[a][b][c] = 1;
  for (register int i = 1; i <= b && i * c < a; ++i) {
    y = (long long)y * (x + i - 1) % p;
    res = (res + (long long)dfs(a - i * c, b - i, c - 1) * y % p * iv[i]) % p;
  }
  return dp[a][b][c] = res;
}
int main() {
  scanf("%d%d%d", &n, &d, &p);
  if (n <= 2) {
    puts("1");
    return 0;
  }
  jc[0] = 1;
  for (register int i = 1; i <= d; ++i) jc[i] = (long long)jc[i - 1] * i % p;
  iv[d] = qpow(jc[d], p - 2);
  for (register int i = d - 1; i >= 0; --i)
    iv[i] = (long long)iv[i + 1] * (i + 1) % p;
  int ans = dfs(n, d, n - 1 >> 1);
  if (!(n & 1)) (ans += cbn(dfs(n >> 1, d - 1, (n >> 1) - 1) + 1, 2)) %= p;
  if (ans < 0) ans += p;
  printf("%d", ans);
  return 0;
}