#Q236. 「一本通 6.6 练习 5」Combination
「一本通 6.6 练习 5」Combination
Description
Original source: BZOJ 2982
LMZ has distinct friends, and every night he selects of them for [censored], ensuring that each night's selection is different. How many such nights can LMZ sustain? Note that LMZ's year consists of days, so he wants to know the answer modulo .
Input Format
The first line contains an integer , indicating the number of test cases.
Each of the next lines contains two integers and , as described in the problem statement.
Output Format
Output lines, each containing a single number, which is the value of .
Sample 1
4
5 1
5 2
7 3
4 2
5
10
35
6
Data Range and Hints
For all test cases, , .