#P12735. 回报
回报
Description
Yuta needs to help Saki find suitable study music.
He has found an album containing songs, numbered from to . Playing each song takes exactly minute. Saki has two courses, A and B, that she needs to study, and each time she study for A and B takes and minutes, respectively. To better assist her, Yuta plans to rearrange the order in which the songs are played. Specifically, he wants to choose a permutation of length such that there exist two cycles and of lengths and , respectively, and every element in is less than every element in .
In a permutation, a cycle of length is a sequence composed of different integers, where , for , and .
Yuta wants to determine how many such permutations exist. Since the answer could be very large, you only need to provide the result modulo .
Input Format
Input a single line containing three integers representing the sequence length and .
Output Format
Output a single integer on a line, indicating the number of permutations that satisfy the requirements, modulo .
4 2 1
3
678 12 34
951781526
1987 654 321
27905503
1000000 13 20
912829543
Hint
Sample 1 Explanation
The permutations that satisfy the requirements are , , and , totaling permutations.
Constraints
This problem enables subtask scoring and subtask dependence, with the constraints and scores for each subtask as follows.
| Subtask No. | Special Constraint | Score | Depends on Subtask | |
|---|---|---|---|---|
| Yes | ||||
| No | ||||
| Yes | ||||
| No | ||||
| Yes | ||||
| No |
Special constraint: .
For all of the testdata, , .
京公网安备 11011102002149号