2. Men_Women

5

2 votes
Combinatorics, Modular arithmetic, Easy
Problem

n people are to be chosen to represent a company from amongst m men and w women, where atleast k men needs to be selected. Your task is the print the number of ways of doing it.Since, the answer could be large, print the answer modulo 1000000007

Constraints :
1<=t<=100000
1<=n<=100000
n-5<=k<=n
k<=m<=100000
n-k<=w<=100000

Input format :
first line contains -
t - number of test cases
next t lines contains 4 integers n,k,m,w

output format :
Print the required answer on a new line

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?