In a turn-based game, players control characters to defeat monsters. Now, you need to find an optimal strategy according to the rules.
In this game, the player holds a shield with $$$A$$$ blood points. Each monster has $$$B$$$ blood points, and a monster dies when the blood is less than or equal to $$$0$$$. In each round, the player chooses a monster(any one of the monsters) and attacks it, then each monster alive will attack the player once. To simplify the problem, all attacks in the game will only drop the target's blood by $$$1$$$ point.
Now the player will fight $$$n$$$ battles. In the $$$i$$$-th battle, there are $$$a_i$$$ monsters. Note that when all the monsters in a battle die, a new battle starts with a new round (which means the player attacks first in the new battle).
A character called Seele can help players kill monsters more efficiently. If the player kills a monster on an attack with Seele's help, he/she can immediately make another attack. For the $$$i$$$-th attack of each battle(for each battle, this count starts at 1), $$$b_i=1$$$ means Seele will offer help, and $$$b_i=0$$$ means she will not. It is guaranteed that when $$$i$$$ is greater than $$$m$$$, $$$b_i=0$$$.
If the remaining shields have less than or equal to $$$0$$$ blood, the player loses. To avoid this condition, please find a strategy to maximize the blood of the remaining shield.
The first line contains two integers $$$A~(1\leq A\leq 10^5)$$$ and $$$B~(1\leq B\leq 20)$$$, the blood points of the shield and monster.
The second line contains two integers $$$n~(1\leq n\leq 10^5)$$$ and $$$m~(1\leq m\leq 2000)$$$, the number of battles and the limit of Seele's help.
The third line contains $$$n$$$ integers, and the $$$i$$$-th integer is $$$a_i~(1\leq a_i\leq100)$$$.
The fourth line contains $$$m$$$ integers, and the $$$i$$$-th integer is $$$b_i~(0\leq b_i\leq 1,0\leq\sum b_i\leq 20)$$$.
If the player loses, output "LOSE". Otherwise, output an integer, the maximum blood of the remaining shield.
100 2 3 6 2 3 4 0 0 0 1 1 1
75
10 3 1 3 1 1 1 0
8
| Name |
|---|


