Lolek loves to play the lottery and to cheat. And recently he found a loophole in the lottery ticket submission system! There is a delay between announcement of the winning numbers and the end of ticket submission.
The rules of the lottery are simple as always. The participant buys a lottery ticket on which $$$n$$$ positive integers are written. Then on a certain day, $$$n$$$ positive integers are announced: the winning numbers. All participants will see them as an array of integers $$$b$$$. Also, the prizes are announced in advance: if the $$$i$$$-th element of the participant's ticket matches the $$$i$$$-th element of the winning ticket, the participant receives $$$c_i$$$ coins.
Lolek decided to use the loophole in the system for his enrichment. He has an official template for a lottery ticket, which is an array $$$a$$$ of size $$$n$$$ filled with ones. Lolek also has a device for changing the digits on the ticket.
Unfortunately, the device is homemade, and works as follows. Lolek can choose two integers $$$i$$$ ($$$1 \leq i \leq n$$$) and $$$z$$$ ($$$z \gt 0$$$) and increase $$$a_i$$$ by $$$\left\lfloor \frac{a_i}{z} \right\rfloor$$$ (the quotient of dividing $$$a_i$$$ by $$$z$$$, rounded down). Lolek can choose the same $$$i$$$ for operations as many times as he wants.
But this process is not fast, and the time for the loophole is limited. In total, Lolek will be able to perform no more than $$$k$$$ operations. Therefore, he asked you to maximize his winnings.
Your task is to determine the maximum number of coins that Lolek can receive by performing no more than $$$k$$$ operations.
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$): the number of integers on the lottery ticket.
The second line contains a single integer $$$k$$$ ($$$0 \leq k \leq 10^6$$$): the maximum number of operations.
The third line contains $$$n$$$ integers $$$b_i$$$ ($$$1 \leq b_i \leq 10^3$$$): the winning lottery ticket.
The fourth line contains $$$n$$$ integers $$$c_i$$$ ($$$0 \leq c_i \leq 10^6$$$): the number of coins received if the numbers match.
A single integer: the maximum number of coins that can be obtained by performing no more than $$$k$$$ operations.
331 2 33 2 1
6
302 3 41 1 1
0
597 5 3 5 32 5 3 2 5
13
| Name |
|---|


