#agc024e. [agc024_e]Sequence Growing Hard

[agc024_e]Sequence Growing Hard

Problem Statement

Find the number of the possible tuples of sequences (A0,A1,...,AN)(A_0,A_1,...,A_N) that satisfy all of the following conditions, modulo MM:

  • For every ii (0leqileqN)(0\\leq i\\leq N), AiA_i is a sequence of length ii consisting of integers between 11 and KK (inclusive);
  • For every ii (1leqileqN)(1\\leq i\\leq N), Ai1A_{i-1} is a subsequence of AiA_i, that is, there exists 1leqxileqi1\\leq x_i\\leq i such that the removal of the xix_i-th element of AiA_i would result in a sequence equal to Ai1A_{i-1};
  • For every ii (1leqileqN)(1\\leq i\\leq N), AiA_i is lexicographically larger than Ai1A_{i-1}.

Constraints

  • 1leqN,Kleq3001 \\leq N,K \\leq 300
  • 2leqMleq1092 \\leq M \\leq 10^9
  • NN, KK and MM are integers.

Input

Input is given from Standard Input in the following format:

NN KK MM

Output

Print the number of the possible tuples of sequences (A0,A1,...,AN)(A_0,A_1,...,A_N), modulo MM.


Sample Input 1

2 2 100

Sample Output 1

5

Five tuples below satisfy the conditions:

  • (),(1),(1,1)(),(1),(1,1)
  • (),(1),(1,2)(),(1),(1,2)
  • (),(1),(2,1)(),(1),(2,1)
  • (),(2),(2,1)(),(2),(2,1)
  • (),(2),(2,2)(),(2),(2,2)

Sample Input 2

4 3 999999999

Sample Output 2

358

Sample Input 3

150 150 998244353

Sample Output 3

186248260