#P2100. 凌乱的地下室
凌乱的地下室
Description
In Xiao Z’s basement, there are small blocks placed side by side (Xiao Z is a hardcore MC fan who likes decorating his basement with small blocks), and each block is different (Xiao Z likes things to be unique), such as grass block, marble, obsidian, etc.
Xiao Z likes to arrange these small blocks in a special order, for example: grass block, marble, obsidian. One day, Xiao D helped Xiao Z tidy up the basement, but the not-so-bright Xiao D forgot the exact positions after moving all the blocks out. With only a vague memory, Xiao D might place the block originally at position to any of positions , , or (of course, the st cannot be placed at position , and the th cannot be placed at position ), for example (corresponding to the example above): marble, grass block, obsidian.
Xiao Z is a generous person. He wants to compute how many possible final arrangements Xiao D could make, and he will not hold Xiao D responsible. Since he is also not very bright, if the answer is large, he only wants to see the last digits (do not show leading zeros).
Count the number of permutations of that satisfy , and take the answer modulo .
Input Format
One line, a positive integer , meaning there are small blocks in Xiao Z’s basement.
Output Format
One line, a positive integer, the number of possible final arrangements Xiao D could make. Output only the last digits, and do not output leading zeros.
3
3
987
223731
Hint
[Sample Explanation 1]
Continuing the example in the statement, there are possibilities: (grass block, marble, obsidian), (marble, grass block, obsidian), (grass block, obsidian, marble).
[Constraints]
For of the testdata, .
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号