408070: GYM102978 H Harsh Comments

Memory Limit:1024 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Harsh Commentstime limit per test1 secondmemory limit per test1024 megabytesinputstandard inputoutputstandard output

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:

  • Choose a comment randomly and delete it. More precisely, let $$$x_1,x_2,\ldots,x_k$$$ be numbers of downvotes the remaining comments have. Then, he will choose the $$$i$$$-th of them with the probability $$$x_i/\left(\sum_{1\leq j \leq k}x_j \right)$$$ and detele it.

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.

Input

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$$$).

Output

Print the answer.

ExamplesInput
1 2
1
1 1
Output
2
Input
1 1
2
1
Output
332748119
Input
3 3
2 3 5
7 11 900000000
Output
636512475

加入题单

算法标签: