题目描述
Problem Description
Docriz is taking an exam and encounters a peculiar multiple-choice question: the question has \( n \) options, with only one being correct. He has no idea how to solve it, so he can only guess.
The guessing process consists of \( n - 2 \) rounds. Before the first round, Docriz will randomly choose one of the \( n \) options. Each subsequent round proceeds as follows: First, Nocriz will help him eliminate one option. Since Nocriz knows the answer beforehand, he will randomly remove one option from the remaining options, excluding the correct one and the one Docriz is currently choosing. After that, Docriz can choose whether to switch his chosen option or not. If he decides to switch, he will randomly switch to any option other than the one he is currently choosing.
Docriz, due to a mysterious agreement with Nocriz, needs to switch his choice exactly \( k \) times during these \( n - 2 \) rounds. He wants to know how to switch to maximize his probability of guessing correctly and output this probability. For convenience, you need to output this probability in its fractional form under modulo \( 10^9 + 7 \).
Input Format
A single line containing two integers \( n \) and \( k \), as described above.
Output Format
A single line containing the answer.
Sample Input and Output
Sample Input #1
3 1
Sample Output #1
666666672
Sample Input #2
3 0
Sample Output #2
333333336
Sample Input #3
4 1
Sample Output #3
750000006
Sample Input #4
4 2
Sample Output #4
625000005
Sample Input #5
100000 99998
Sample Output #5
439903656
Notes
Samples 1 to 4 correspond to \(\frac{2}{3}\), \(\frac{1}{3}\), \(\frac{3}{4}\), and \(\frac{5}{8}\) respectively.
For 30% of the data, it is guaranteed that \( 5 \leq n \leq 10 \).
For another 5% of the data, it is guaranteed that \( k = 0 \).
For another 10% of the data, it is guaranteed that \( k = 1 \).
For another 10% of the data, it is guaranteed that \( k = n - 2 \).
For another 5% of the data, it is guaranteed that \( n \leq 10^2 \).
For another 10% of the data, it is guaranteed that \( n \leq 10^3 \).
For 100% of the data, it is guaranteed that \( 5 \leq n \leq 10^5 \) and \( 0 \leq k \leq n - 2 \).
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分