#arc134f. [arc134_f]Flipping Coins
[arc134_f]Flipping Coins
Problem Statement
There are coins numbered arranged in a row. Initially, all coins face up.
Snuke chooses a permutation of with equal probability, and do operations. The -th operation does the following.
- If the coin numbered faces down, do nothing.
- If the coin numbered faces up, turn that coin over and then turn over the coin numbered .
After the operations, Snuke will receive yen (Japanese currency) from his mother, where is the number of coins facing up.
Find the expected value of the amount Snuke will get, multiplied by (it can be proved that this is an integer), modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the expected value of the amount Snuke will get, multiplied by , modulo .
Sample Input 1
4 2
Sample Output 1
90
- When , the operations go as follows.
- In the -st operation, the coin numbered faces down, and then the coin numbered faces up.
- In the -nd operation, the coin numbered faces down, and then the coin numbered faces down.
- In the -rd operation, the coin numbered faces down, and then the coin numbered faces up.
- In the -th operation, nothing is done.
- In the end, two coins face up, so he receives yen.
Sample Input 2
2 100
Sample Output 2
10001
Sample Input 3
200000 12345
Sample Output 3
541410753
- Be sure to find the value modulo .