Today is Alice's birthday! To celebrate it, she went to a high-end restaurant to have dinner. As it was her first time having dinner in an expensive restaurant, she felt very excited and ordered a lot of foods.
However, she found that she has ordered too many foods and she could not finish all of them. As there are too many leftovers on the table and she does not want to waste them, she decided to wrap the leftovers up and eat them at home in the future.
Alice has got some to-go boxes from the server for the leftovers. She has to-go boxes that can hold unit of foods, to-go boxes that can hold units of foods, to-go boxes that can hold units of foods, and to-go boxes that can hold units of foods. There are also dishes that Alice cannot finish. For the dish, there is units of food left.
She is trying to wrap up as many units of food as possible following these rules:
For each dish, you can only pack the whole dish or not pack the dish. Also, every unit of the same dish must be packed into the same to-go box. E.g., you cannot pack a dish with units into two to-go boxes with a capacity of units or pack out of units of a dish into a to-go box.
To pack a dish into a to-go box, the capacity of the to-go box must not be less than the units of the dish. E.g., you cannot pack a dish with units into a to-go box with a capacity of units.
You may pack multiple dishes into the same to-go box. However, as Alice does not like the sauces of dishes mixed together, if more than one kind of dish is packed into the same to-go box, half of the capacity of the to-go box must remain empty to keep distance between different dishes. E.g., you cannot pack a dish with unit and a dish with units into a to-go box with a capacity of units, as there are only units of capacity remaining, which is less than half of the original capacity of the to-go box.
She wants to know what is the maximum amount of units of foods she can wrap up. Can you help her?
Input
第一行有五個整數 , , , 和 ,菜的數量和能載 、、、 單位食物的打包盒的數量。
第二行有 個整數 ,愛麗絲吃剩的第 道菜的單位。
The first line consists of 5 integers: , , , , and . These integers represent the number of dishes and the number of to-go boxes with capacities of , , , and units, respectively.
The second line contains integers , the number of units of the dish that Alice cannot finish.
Output
輸出一個整數,愛麗絲可以打包的最大食物單位數量。
Output an integer, the maximum amount of units of foods that Alice can wrap up.