Vasya's sawmill recently received a new order. To build a new house, the mayor of a neighboring town needs a planks of length x feet and b planks of length y feet.
Since the sawmill only has an unlimited supply of z-foot boards, Vasya was assigned to fulfill the customer's order by sawing the available boards into smaller ones. Vasya wants to finish the job as quickly as possible, so he wants to complete the order with as few cuts as possible. In this case, the number of used boards of length z does not play a role, in addition, some of the boards formed as a result of sawing may not be required for ordering and remain at the sawmill.
For example, if the sawmill has boards of length 80, and the client needs two boards of length 30 and seven boards of length 20, then it is enough to make seven cuts: one board is cut with two cuts into boards of length 20, 30 and 30, one by three cuts into four boards of length 20 and one with two cuts into boards of length 20, 20 and 40. The client does not need a board of length 40, it will remain at the sawmill, the rest of the boards will be sent to the client.
Input
The input of the program is the numbers a, x, b, y and z. All numbers are positive and do not exceed 300, x<=z, y<=z, x!=y.
Output
Output the minimum number of cuts required to complete an order.
Input |
Output |
2 30 7 20 80 |
7 |