#abc282g. [abc282_g]Similar Permutation
[abc282_g]Similar Permutation
Problem Statement
Below, a permutation of is simply called a permutation.
For two permutations , let us define their similarity as the number of integers between and such that:
- .
Find the number, modulo a prime number , of pairs of permutations whose similarity is .
Constraints
- is a prime number.
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 1 282282277
Sample Output 1
16
For instance, below is a pair of permutations that satisfies the condition.
Here, we have and , so the similarity of and is .
Sample Input 2
50 25 998244353
Sample Output 2
131276976
Print the number modulo .