282. Isomorphism
Time limit per test: 10 seconds
Memory limit: 64 megabytes
input: standard
output: standard
Let's call a
a non-oriented graph such that each pair of different vertices is connected by exactly one edge, colored in any of
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
,
and a prime
. Your task is to find the number of distinct non-isomorphic graphs having
vertices. The number should be output modulo
.
Input
The only line of the input contains three integers
,
,
(
,
,
).
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