Score : 2000 points
Given are integers N and K, and a prime number P. Find the number, modulo P, of directed graphs G with N vertices that satisfy below. Here, the vertices are distinguishable from each other.
Input is given from Standard Input in the following format:
N K P
Print the number of directed graphs that satisfy the conditions, modulo P.
4 3 998244353
56
Among the 64 graphs with four vertices, 8 are isomorphic to the forbidden induced subgraphs, and the other 56 satisfy the conditions.
7 3 998244353
720
50 37 998244353
495799508