Metro
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Semyon, Yura, and the other olympiad participants are traveling by metro. In total, there are n people making the journey, and each person needs to take m trips.
The metro offers three types of tickets:
A single-trip ticket, costing a hryvnias.
An unlimited ticket for one person, costing b hryvnias.
A group unlimited ticket for exactly k people, costing c hryvnias.
Note that the group ticket must be used by exactly k people, no more, no less.
Your task is to calculate the minimum total cost for all the necessary tickets.
Input Format
The first line contains three integers n, m, and k (1 ⩽ n, m, k ⩽ 1,000).
The second line contains three integers a, b, and c (1 ⩽ a, b, c ⩽ 1,000).
Output Format
Output a single integer representing the minimum total cost of the tickets.
Examples
Input #1
Answer #1
Submissions 423
Acceptance rate 27%