Festival is coming and Andrea decides to buy
In her city, there are only 1 dollar coins and 100 dollar notes. Before shopping, Andrea prepares
There is only one cashier in the store and his efficiency depends on the gift he sells. For the
Andrea wants to pay in such a way that the total time she needs to check out should be as small as possible.
Please help her to find out the minimum time she needs!
The first line contains two integers
The second line contains
The third line contains
The output should be an integer representing the minimum time Andrea needs.
5 34
15 760 755 411 950
2 2 2 2 2
170
5 193
178 887 466 475 10
816 136 880 340 800
10268