Beautiful Sequence Unraveling

아직 제출이 없습니다시간 제한7초메모리 제한512 MB

문제

You are a happy possessor of the powerful tool called Beautiful Sequence Unraveler (BSU). This tool works with beautiful sequences. A beautiful sequence is an array a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n of nn integers for which the following statement holds: there are no integers ii such that 1i<n1 \le i < n and maxa_1,,a_i=mina_i+1,a_n\max\\{a\_1, \dots, a\_i\\} = \min\\{a\_{i + 1}, \dots a\_n\\}.

BSU deals with beautiful sequences pretty well, but you do not know how frequently such sequences occur. So you want to calculate the number of beautiful sequences among all the arrays of length nn which consist of integers between 11 and kk, inclusively. Since this number may be large, you are required to calculate it modulo prime number pp.

입력

The only line contains three integers nn, kk, pp (1n4001 \le n \le 400, 1k1081 \le k \le 10^8, 998,244,353p109+9998\\,244\\,353 \le p \le 10^9 + 9).

It is guaranteed that pp is prime.

출력

Print the answer to the problem modulo pp.