282. Isomorphism
Time limit per test: 1.25
second(s)
Memory limit: 65536
kilobytes
input: standard
output: standard
Let's call a
a nonoriented graph such that each pair of different vertices is connected by exactly one edge, colored in any of
M different colors. Two colored graphs are
if the vertices of the first graph can be renumbered in such a way that it becomes equal to the second graph (i.e. the colors of the edges are the same).
You are given
N,
M and a prime
P. Your task is to find the number of distinct nonisomorphic graphs having
N vertices. The number should be output modulo
P.
Input
The only line of the input contains three integers
N,
M,
P (1≤
N≤ 53, 1≤
M≤ 1000,
N9).
Output
Output the answer to the problem in the only line of the output.
Example(s)
sample input

sample output

1 1 2

1

sample input

sample output

3 2 97

4

sample input

sample output

3 4 97

20

Novosibirsk SU Contest #2, by Novosibirsk Team #1