atcoder#DWACON6THPRELIMSC. Cookie Distribution
Cookie Distribution
Score : points
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.
3 2
3 2
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 .
856 16
399 263 665 432 206 61 784 548 422 313 848 478 827 26 398 63
337587117
- Find the expected value multiplied by $\binom{N}{a_1} \times \binom{N}{a_2} \times \ldots \times \binom{N}{a_K}$, modulo .