Positions in Permutations
2s · 256 MBPermutation is an ordered set of integers , consisting of distinct positive integers, each of them doesn't exceed . We'll denote the -th element of permutation as . We'll call number the size or the length of permutation .
We'll call position ( ) in permutation good, if . Count the number of permutations of size with exactly good positions. Print the answer modulo ( ).
Input
The single line contains two space-separated integers and ( ).
Output
Print the number of permutations of length with exactly good positions modulo ( ).
Note
The only permutation of size 1 has 0 good positions.
Permutation has 0 good positions, and permutation has 2 positions.
Permutations of size 3:
— 0 positions

— 2 positions

— 2 positions

— 2 positions

— 2 positions
- — 0 positions
1 0
1
2 1
0
3 2
4