Codeforces Round 608 (Div. 2)
A
Suits
Codeforces
800
原题
←B →
翻译中…

A new delivery of clothing has arrived today to the clothing store. This delivery consists of $a$ ties, $b$ scarves, $c$ vests and $d$ jackets.

翻译中…

The store does not sell single clothing items — instead, it sells suits of two types:

翻译中…
  • a suit of the first type consists of one tie and one jacket;
  • a suit of the second type consists of one scarf, one vest and one jacket.
翻译中…

Each suit of the first type costs $e$ coins, and each suit of the second type costs $f$ coins.

翻译中…

Calculate the maximum possible cost of a set of suits that can be composed from the delivered clothing items. Note that one item cannot be used in more than one suit (though some items may be left unused).

翻译中…

Input

翻译中…

The first line contains one integer $a$ $(1 \le a \le 100\,000)$ — the number of ties.

翻译中…

The second line contains one integer $b$ $(1 \le b \le 100\,000)$ — the number of scarves.

翻译中…

The third line contains one integer $c$ $(1 \le c \le 100\,000)$ — the number of vests.

翻译中…

The fourth line contains one integer $d$ $(1 \le d \le 100\,000)$ — the number of jackets.

翻译中…

The fifth line contains one integer $e$ $(1 \le e \le 1\,000)$ — the cost of one suit of the first type.

翻译中…

The sixth line contains one integer $f$ $(1 \le f \le 1\,000)$ — the cost of one suit of the second type.

翻译中…

Output

翻译中…

Print one integer — the maximum total cost of some set of suits that can be composed from the delivered items.

翻译中…

Note

翻译中…

It is possible to compose three suits of the second type in the first example, and their total cost will be $6$. Since all jackets will be used, it's impossible to add anything to this set.

翻译中…

The best course of action in the second example is to compose nine suits of the first type and eleven suits of the second type. The total cost is $9 \cdot 4 + 11 \cdot 6 = 102$.

翻译中…

样例

Input #1
4
5
6
3
1
2
Output #1
6
InputCopy OutputCopy
Input #2
12
11
13
20
4
6
Output #2
102
InputCopy OutputCopy
Input #3
17
14
5
21
15
17
Output #3
325
InputCopy OutputCopy
题目信息
题号
1271A
时间限制
1 s
内存限制
256 MB
标签
暴力
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。