~/algor $ cat problems/guruhlashlar-soni
Number of combinations
Hard
2000 ms
128 MB
67%
A class has $n$ students. Find the number of ways to choose $k$ of them for an olympiad (the order of choice does not matter). Answer $q$ such queries.
Input
The first line contains a positive integer $q$. Each of the next $q$ lines contains two integers: $n$ and $k$.
Output
For each query, on a separate line, one integer — the number of ways modulo $10^{9} + 7$.
Note
$1 \le q \le 10^{5}$
$0 \le k \le n \le 10^{6}$
Examples
Input #1
3 5 2 4 0 10 10
Output #1
10 1 1
Input #2
1 1000000 500000
Output #2
996692777