SOLVE
LATER
Voldemort's army is marching towards Hogwarts. The army consists of N different types of Death Eaters. Luckily, Harry knows Q spells, each of which will exterminate exactly K Death Eaters from the army. He wants to know the number of ways in which he can select a group of exactly K Death Eaters (of various types) he wishes to exterminate using each spell. Two groups are considered different if count of atleast one type of Death Eater is different in both the groups. We can assume that Death Eaters of same type are similar in all aspects.
First line contains N , the types of Death Eaters. Next line contains N numbers where ith number is the number of Death Eaters in the army of ith type. Next line contain Q, the number of spells. Next Q lines contain a number K, the number of Death Eaters it can exterminate.
Print Q lines with a number each giving the number of ways to select a group of Death Eaters of various types to be exterminated. Print the number mod 10^9 +7.
1 <= N <= 10^6
1 <= a[i] <= 1000
1 <= Q <= 1000
1 <= K <= 1000
Print ans mod(10^9 + 7).
Use Fast I/O.
In The Sample Test case, there are 2 queries. For the first query, the value of K is 9 and the answer is 3. The 3 different ways are:-
Similarly, for the second query, the value of K is 10 and the answer is 2. The 2 different ways are:-