Byteman is going for a car trip around Byteland, but he is unfortunately unable to buy a map of the country. His friends told him about some properties of the bytean road network:
cities in Byteland, numbered from
to
.
roads.
and
are connected by a road on the first plan
then their equivalents
and
are also connected by a road on the
second plan.
Write a program that:
,
and
from the standard input,
,
The first and only line of the input contains three integers
,
and
(
,
,
,
is a prime number), separated with single spaces.
The first and only line of output should contain a single integer
- the remainder of the division by
of the number of different
plans that are consistent with conditions known to Byteman.
For the input data:
6 3 13
the correct result is:
2

Task author: Jakub Radoszewski.
W razie problemów technicznych ze Szkopułem, prosimy o kontakt mailowy pod adresem szkopul@fri.edu.pl.
Jeśli chciałbyś porozmawiać o zadaniach, rozwiązaniach lub problemach technicznych, odwiedź nasze serwery na Discordzie. Są one moderowane przez społeczność, ale członkowie zespołu wsparcia również aktywnie się tam udzielają.