시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 33 | 12 | 11 | 34.375% |
You will color an array consisting of $N$ cells numbered $1$ to $N$ for the array game party.
In the attic, there are two types of crayons, A and B, and $M$ bags for each type, which the $i$-th bag has crayons with color $i$.
In each bag, there are several crayons having pairwise different thicknesses.
You have to color the cells like the following:
How many ways are there to color the $N$ cells? Consider as a different way if at least one of the two bags you chose is different or the crayon you used to color a particular cell has a different type, color, or thickness.
The first line contains two integers $N$ and $M$ — the number of cells and the number of bags of each crayon type, respectively.
The second line contains $M$ integers $A_1, \, A_2, \, \cdots, \, A_M$, where $A_i$ is the number of crayons in the $i$-th bag of type A.
The third line contains $M$ integers $B_1, \, B_2, \, \cdots, \, B_M$, where $B_j$ is the number of crayons in the $j$-th bag of type B.
Print the number of ways to color the $N$ cells, modulo $10^9+7$.
1 3 1 2 3 2 3 1
24