#P45. [KBC003E] Permutation
[KBC003E] Permutation
Source
This problem is adapted from Long Long OJ. All rights reserved.
Problem Description
There is a permutation of size , which satisfies and for each where , .
Given , find the number of possible such permutations.
Since the output may be extremely large, the answer should be taken modulo .
Input Format
The input consists of a single line containing an integer .
Output Format
Output the number of possible permutations.
Samples
4
4
32132
876675871
Sample 1 Explanation
The permutations are .
Data Range
For 100% of the data: .