시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 1024 MB | 3 | 3 | 3 | 100.000% |
Posted on a blog are $N+M$ harsh comments. You made $N$ comments, and the $i$-th of them has $A_i$ downvotes. The $i$-th of the other $M$ comments has $B_i$ downvotes.
Mike is going to delete the comments, one by one, by repeating the following operation:
Note that the choices in the operations are independent.
Find the expected number of operations Mike will do until he deletes all of your comments. The answer is a rational number, so print it modulo $998244353$ as usual. We can prove that such representation is always possible under the constraints of this problem.
The first line contains integers $N$ and $M$ ($1 \leq N,M \leq 100$).
The second line contains integers $A_1,A_2,\ldots,A_N$ ($1 \leq A_i \leq 100$).
The third line contains integers $B_1,B_2,\ldots,B_M$ ($1 \leq B_i$, $\sum_{1 \leq i \leq N} A_i + \sum_{1 \leq i \leq M} B_i < 998244353$).
Print the answer.
1 2 1 1 1
2
1 1 2 1
332748119
3 3 2 3 5 7 11 900000000
636512475