Semyon, Yura, and the other olympiad participants are traveling by metro. In total, there are people making the journey, and each person needs to take trips.
The metro offers three types of tickets:
A single-trip ticket, costing hryvnias.
An unlimited ticket for one person, costing hryvnias.
A group unlimited ticket for exactly people, costing hryvnias.
Note that the group ticket must be used by exactly people, no more, no less.
Your task is to calculate the minimum total cost for all the necessary tickets.
The first line contains three integers , , and (1 \leqslant n, m, k \leqslant 1000).
The second line contains three integers , , and (1 \leqslant a, b, c \leqslant 1000).
Output a single integer representing the minimum total cost of the tickets.
Example 1