Binomial coefficient - MarisaOJ: Marisa Online Judge

Binomial coefficient

Time limit: 1000 ms
Memory limit: 256 MB
There are q queries, each of the form (n,k), calculate the binomial coefficient: (nk)=n!k!(n−k)! ### Input - The first line contains an integer q. - Each line in the next q lines contains 2 integers n,k. ### Output - Print each binominal coefficient modulo 109+7. ### Constraints - 1≤q≤106. - 1≤k≤n≤106. ### Example Input: 26453 Output: 1510