Metro#8777

Metro

1 second
64 megabytes
Very easy

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:

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.

Input

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

Output a single integer representing the minimum total cost of the tickets.

Examples

Example 1

Loading
Loading