#dwacon6thprelimsc. [dwacon6th_prelims_c]Cookie Distribution
[dwacon6th_prelims_c]Cookie Distribution
Problem Statement
There are children, numbered . In the next days, we will give them some cookies. In the -th day, we will choose children among the with equal probability, and give one cookie to each child chosen. (We make these choices independently.)
Let us define the happiness of the children as , where is the number of cookies received by Child in the days. Find the expected happiness multiplied by $\\binom{N}{a_1} \\times \\binom{N}{a_2} \\times \\ldots \\times \\binom{N}{a_K}$ (we can show that this value is an integer), modulo .
Notes
denotes the number of possible choices of objects out of given distinct objects, disregarding order.
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 2
3 2
Sample Output 1
12
- On the first day, all the children , , and receive one cookie.
- On the second day, two out of the three children , , and receive one cookie.
- Their happiness is in any case, so the expected happiness is . Print this value multiplied by , which is .
Sample Input 2
856 16
399 263 665 432 206 61 784 548 422 313 848 478 827 26 398 63
Sample Output 2
337587117
- Find the expected value multiplied by $\\binom{N}{a_1} \\times \\binom{N}{a_2} \\times \\ldots \\times \\binom{N}{a_K}$, modulo .