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. 


-----Examples-----
Input
4
5
6
3
1
2

Output
6

Input
12
11
13
20
4
6

Output
102

Input
17
14
5
21
15
17

Output
325



-----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$.

Difficulty: EASY

Solutions:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
for i in range(d + 1):
	x = min(a, i) * e
	y = min(b, c, d - i) * f
	ans = max(x + y, ans)
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
pro = 0
if e >= f:
	temp = min(a, d)
	a -= temp
	d -= temp
	pro += temp * e
	if d > 0:
		temp = min(b, c, d)
		pro += temp * f
elif e < f:
	temp = min(b, c, d)
	b -= temp
	c -= temp
	d -= temp
	pro += temp * f
	if d > 0:
		temp = min(a, d)
		pro += temp * e
print(pro)


(a, b) = (int(input()), int(input()))
(c, d) = (int(input()), int(input()))
(e, f) = (int(input()), int(input()))
if e > f:
	ans1 = min(a, d)
	a -= ans1
	d -= ans1
	ans2 = min(b, c, d)
	print(ans1 * e + ans2 * f)
else:
	ans2 = min(b, c, d)
	c -= ans2
	d -= ans2
	b -= ans2
	ans1 = min(a, d)
	print(ans1 * e + ans2 * f)


(a, b, c, d, e, f) = (int(input()) for x in range(6))
print()
if e > f:
	print(min(a, d) * e + f * min(b, c, d - min(a, d)))
else:
	print(min(b, c, d) * f + e * min(a, d - min(b, c, d)))


(a, b, c, d, e, f) = [int(input()) for i in range(6)]
(x, y) = (min(a, d), min(b, c, d))
m = x * e + min(b, c, d - x) * f
n = y * f + min(a, d - y) * e
print(max(m, n))


import sys
import math
import itertools
import collections

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
a = ii()
b = ii()
c = ii()
d = ii()
e = ii()
f = ii()
ans = 0
if e >= f:
	ans += e * min(a, d)
	d -= min(a, d)
	ans += f * min(b, c, d)
else:
	ans += f * min(b, c, d)
	d -= min(b, c, d)
	ans += e * min(a, d)
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e <= f:
	m = min(b, c, d)
	r = m * f
	q = min(a, d - m)
	r = r + q * e
	print(r)
else:
	n = min(a, d)
	w = n * e + min(b, c, d - n) * f
	print(w)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x = a
y = min(b, c)
an = 0
for i in range(d + 1):
	o = min(x, i)
	p = o * e + f * min(y, d - i)
	an = max(p, an)
print(an)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x = min(a, d)
y = min(max(0, d - x), b, c)
ans1 = x * e + y * f
x = min(b, c, d)
y = min(max(0, d - x), a)
ans2 = x * f + y * e
print(max(ans1, ans2))


import math as mt
import sys, string
from collections import Counter, defaultdict
input = sys.stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
ARR = lambda : list(map(int, input().split()))

def printARR(arr):
	for e in arr:
		print(e, end=' ')
	print()

def main():
	a = I()
	b = I()
	c = I()
	d = I()
	e = I()
	f = I()
	c1 = min(a, d) * e
	c2 = min(b, c, d) * f
	if min(b, c, d) <= d:
		c2 += min(a, d - min(b, c, d)) * e
	if min(a, d) <= d:
		c1 += min(b, c, d - min(a, d)) * f
	print(max(c1, c2))
tc = 1
for _ in range(tc):
	main()


parts = []
ans = 0
for i in range(4):
	parts.append(int(input()))
e = int(input())
f = int(input())
if e <= f:
	num_set_a = min(parts[1:])
	ans += f * num_set_a
	parts[1] -= num_set_a
	parts[2] -= num_set_a
	parts[3] -= num_set_a
	num_set_b = min(parts[0], parts[3])
	ans += e * num_set_b
else:
	num_set_a = min(parts[0], parts[3])
	ans += e * num_set_a
	parts[0] -= num_set_a
	parts[3] -= num_set_a
	num_set_b = min(parts[1:])
	ans += f * num_set_b
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
if e > f:
	ans += e * min(a, d)
	d = d - min(a, d)
	min1 = min(b, d)
	min2 = min(c, d)
	mini = min(min1, min2)
	ans += f * mini
else:
	l = []
	l.append(b)
	l.append(c)
	l.append(d)
	ans += f * min(l)
	d = d - min(l)
	ans += e * min(a, d)
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
print(max(min(a, d) * e + min(b, c, d - min(a, d)) * f, min(b, c, d) * f + min(a, d - min(b, c, d)) * e))


a = int(input())
b = int(input())
c = int(input())
D = int(input())
e = int(input())
f = int(input())
cost = 0
temp_cost = 0
if e != f:
	d = D
	temp = min(b, c, d)
	temp_cost += temp * f
	if d >= temp:
		d -= temp
		temp = min(d, a)
		temp_cost += temp * e
	d = D
	if d > a:
		cost += e * a
		d -= a
		temp = min(d, b, c)
		cost += temp * f
	else:
		cost += e * d
else:
	d = D
	if a > b and a > c:
		temp = min(a, d)
		cost += temp * e
		if temp <= d:
			d -= temp
			temp = min(b, c, d)
			cost += temp * f
	else:
		temp = min(b, c, d)
		cost += temp * f
		if temp <= d:
			d -= temp
			temp = min(a, d)
			cost += temp * e
if cost > temp_cost:
	print(cost)
else:
	print(temp_cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	cnt = min(a, d)
	print(cnt * e + min(b, c, d - cnt) * f)
else:
	cnt = min(b, c, d)
	print(min(a, d - cnt) * e + cnt * f)


exec((6 * '{} = int(input());').format('a', 'b', 'c', 'd', 'e', 'f'))
print(max(min(a, d) * e + min(max(d - a, 0), b, c) * f, min(d, b, c) * f + min(max(d - min(b, c), 0), a) * e))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ymax = min(b, c)
xmax = a
if e > f:
	if d > a:
		x = a
		if d - a <= ymax:
			y = d - a
		else:
			y = ymax
	else:
		x = d
		y = 0
elif e < f:
	if d > ymax:
		y = ymax
		if d - ymax <= a:
			x = d - ymax
		else:
			x = a
	else:
		y = d
		x = 0
elif xmax + ymax <= d:
	x = xmax
	y = ymax
else:
	x = xmax
	y = d - xmax
cost = x * e + y * f
print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
bc = min(b, c)
if e > f:
	answer = min(a, d) * e + min(d - min(a, d), bc) * f
else:
	answer = min(bc, d) * f + min(d - min(bc, d), a) * e
print(answer)


l = int(input())
w = int(input())
p = int(input())
j = int(input())
a = int(input())
b = int(input())
if a > b:
	if l >= j:
		print(j * a)
	else:
		k = j - l
		t = min([k, w, p])
		print(l * a + b * t)
else:
	c = min([w, p, j])
	if j <= c:
		print(j * b)
	else:
		k = j - c
		t = min(k, l)
		print(c * b + t * a)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
m = 0
if e > f:
	m += e * min(a, d)
	d -= min(a, d)
	m += f * min(b, c, d)
else:
	m += f * min(b, c, d)
	d -= min(b, c, d)
	m += e * min(a, d)
print(m)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
cost1 = 0
cost2 = 0
if f > e:
	mn = min(b, c, d)
	cost2 = mn * f
	cost1 = min(d - mn, a) * e
elif e > f:
	mn = min(a, d)
	cost1 = mn * e
	cost2 = min(d - mn, b, c) * f
else:
	mn = min(b, c, d)
	cost2 = mn * f
	cost1 = min(d - mn, a) * e
print(cost1 + cost2)


d = {}
a = int(input())
d['t'] = a
s = int(input())
d['s'] = s
v = int(input())
d['v'] = v
j = int(input())
d['j'] = j
e = int(input())
f = int(input())
if e >= f:
	x = min(d['t'], d['j'])
	d['t'] -= x
	d['j'] -= x
	y = min(d['j'], d['s'], d['v'])
	print(e * x + f * y)
else:
	y = min(d['v'], d['s'], d['j'])
	d['v'] -= y
	d['s'] -= y
	d['j'] -= y
	x = min(d['t'], d['j'])
	print(e * x + f * y)


(a, b, c, d, e, f) = [int(input()) for i in range(6)]
count = 0
if f > e:
	h = min(b, c, d)
	count += h * f
	if h != d:
		d -= h
		l = min(d, a)
		count += l * e
else:
	h = min(d, a)
	count += e * h
	if h != d:
		d -= h
		l = min(b, c, d)
		count += f * l
print(count)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
h = 0
if e >= f:
	g = min(a, d)
	h = h + g * e
	if d > a:
		d = d - a
		g = min(d, c, b)
		h = h + g * f
else:
	g = min(d, c, b)
	h = h + g * f
	if g != d:
		d = d - g
		g = min(d, a)
		h = h + g * e
print(h)


(a, b, c, d, e, f) = [int(input()) for _ in range(6)]
ans = 0
if e >= f:
	first = min(a, d)
	ans += first * e
	d -= first
	second = min(b, c, d)
	ans += second * f
else:
	second = min(b, c, d)
	ans += second * f
	d -= second
	first = min(a, d)
	ans += first * e
print(ans)


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return list(map(int, input().split()))

def getList():
	return list(map(int, input().split()))

def getStr():
	return input().strip()
a = getInt()
b = getInt()
c = getInt()
d = getInt()
e = getInt()
f = getInt()
res = 0
if e > f:
	res += min(a, d) * e
	res += min(b, c, d - min(a, d)) * f
else:
	res += min(b, c, d) * f
	res += min(a, d - min(b, c, d)) * e
print(res)


def get_std_input():
	return (int(input()), int(input()), int(input()), int(input()), int(input()), int(input()))

def find_max_cart_price(data):
	(a, b, c, d, e, f) = data
	max_t1 = min(a, d)
	max_t2 = min(b, c, d)
	if min(max_t1, max_t2) == max_t1:
		min_ct = max_t1
		max_ct = max_t2
		min_price = e
		max_price = f
	else:
		min_ct = max_t2
		max_ct = max_t1
		min_price = f
		max_price = e
	max_cart_price = 0
	for ct_max in range(max_ct + 1):
		ct_min_poss = d - ct_max
		ct_min = min(ct_min_poss, min_ct)
		curr_cart_price = ct_max * max_price + ct_min * min_price
		if not ct_max:
			curr_cart_price = (max_ct - min_ct) * max_price + min_ct * min_price
		max_cart_price = max(max_cart_price, curr_cart_price)
	return max_cart_price
test = get_std_input()
print(find_max_cart_price(test))


a = [int(input()) for i in range(6)]
if a[5] > a[4]:
	c = min(a[1:4])
	print(a[5] * c + a[4] * max(0, min(a[0], a[3] - c)))
else:
	c = min(a[0], a[3])
	print(a[4] * c + a[5] * max(0, min(a[1], a[2], a[3] - c)))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s = 0
if e >= f:
	l = [a, d]
	s += min(l) * e
	d -= min(l)
	l = [b, c, d]
	s += min(l) * f
	d -= min(l)
else:
	l = [b, c, d]
	s += min(l) * f
	d -= min(l)
	l = [a, d]
	s += min(l) * e
	d -= min(l)
print(s)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	nb = min(d, a)
	ans = nb * e
	nb1 = min(c, b, d - nb)
	ans += f * nb1
else:
	nb = min(d, c, b)
	ans = f * nb
	nb1 = min(a, d - nb)
	ans += e * nb1
print(ans)


p = [int(input()) for i in range(6)]
print(min(p[0], p[3]) * p[4] + min(p[1], p[2], p[3] - min(p[0], p[3])) * p[5]) if p[4] > p[5] else print(min(p[1], p[2], p[3]) * p[5] + min(p[0], p[3] - min(p[1], p[2], p[3])) * p[4])


I = lambda : int(input())
a = I()
b = I()
c = I()
d = I()
e = I()
f = I()
if e >= f:
	suit1 = min(a, d)
	suit2 = min(b, c, d - suit1)
	print(suit1 * e + suit2 * f)
else:
	suit2 = min(b, c, d)
	suit1 = min(a, d - suit2)
	print(suit1 * e + suit2 * f)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
c1 = 0
if e > f:
	c1 += min(a, d) * e
	c1 += min(b, min(c, d - min(a, d))) * f
elif f > e:
	c1 += min(b, min(c, d)) * f
	c1 += min(a, d - min(b, min(c, d))) * e
else:
	(x, y) = (0, 0)
	x += min(a, d) * e
	x += min(b, min(c, d - min(a, d))) * f
	y += min(b, min(c, d)) * f
	y += min(a, d - min(b, min(c, d))) * e
	c1 = max(x, y)
print(c1)


from collections import deque

def solve():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	pierwsze = e > f
	sum = 0
	for i in range(2):
		if pierwsze:
			taken = min(a, d)
			a -= taken
			d -= taken
			sum += taken * e
		if not pierwsze:
			taken = min(b, c, d)
			b -= taken
			c -= taken
			d -= taken
			sum += taken * f
		pierwsze = not pierwsze
	return sum
print(solve())


(a, b, c, d, e, f) = [int(input()) for i in range(6)]
q = min(a, d)
dd = d - q
ans = e * q + f * min(b, c, dd)
w = min(b, c, d)
dd = d - w
ans = max(ans, e * min(a, dd) + f * w)
print(ans)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
cost = 0
if e > f:
	cost += min(t, j) * e
	j -= min(t, j)
	cost += min(j, v, s) * f
else:
	cost += min(j, v, s) * f
	j -= min(j, v, s)
	cost += min(t, j) * e
print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	res = e * min(a, d) + f * min(b, c, max(0, d - min(a, d)))
else:
	res = e * min(a, max(0, d - min(b, c, d))) + f * min(b, c, d)
print(res)


a = []
for i in range(6):
	a.append(int(input()))
cost = 0
if a[4] <= a[5]:
	cost += a[5] * min(a[1:4])
	a[3] -= min(a[1:4])
	cost += a[4] * min(a[0], a[3])
else:
	cost += a[4] * min(a[0], a[3])
	a[3] -= min(a[0], a[3])
	cost += a[5] * min(a[1:4])
print(cost)


(a, b, c, d, e, f) = (int(input()), int(input()), int(input()), int(input()), int(input()), int(input()))
ans = 0
if e > f:
	cnt = min(a, d)
	ans += cnt * e
	d -= cnt
	cnt2 = min(b, c, d)
	ans += cnt2 * f
else:
	cnt2 = min(b, c, d)
	ans += cnt2 * f
	d -= cnt2
	cnt = min(a, d)
	ans += cnt * e
print(ans)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
s1 = int(input())
s2 = int(input())
cost1 = 0
cost2 = 0
if s1 >= s2:
	k = min(ties, jackets)
	cost1 += k * s1
	j2 = jackets - k
	l = min(scarves, vests, j2)
	cost1 += l * s2
if s1 <= s2:
	l = min(scarves, vests, jackets)
	cost2 += l * s2
	j1 = jackets - l
	k = min(ties, j1)
	cost2 += k * s1
if s1 > s2:
	print(cost1)
elif s1 < s2:
	print(cost2)
elif s1 == s2:
	print(max(cost1, cost2))


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
tipo1 = int(input())
tipo2 = int(input())
cost1 = 0
cost2 = 0
if tipo1 > tipo2:
	if ties < jackets:
		jackets -= ties
		cost1 = tipo1 * ties
		ties = 0
	else:
		ties -= jackets
		cost1 = tipo1 * jackets
		jackets = 0
	if jackets > 0:
		minimo = min(jackets, min(scarves, vests))
		if minimo == jackets:
			scarves -= jackets
			vests -= jackets
			cost2 = tipo2 * jackets
			jackets = 0
		elif minimo == scarves:
			jackets -= scarves
			vests -= scarves
			cost2 = tipo2 * scarves
			scarves = 0
		else:
			scarves -= vests
			jackets -= vests
			cost2 = tipo2 * vests
			vests = 0
	print(cost1 + cost2)
else:
	minimo = min(jackets, min(scarves, vests))
	if minimo == jackets:
		scarves -= jackets
		vests -= jackets
		cost2 = tipo2 * jackets
		jackets = 0
	elif minimo == scarves:
		jackets -= scarves
		vests -= scarves
		cost2 = tipo2 * scarves
		scarves = 0
	else:
		scarves -= vests
		jackets -= vests
		cost2 = tipo2 * vests
		vests = 0
	if jackets > 0:
		if ties < jackets:
			jackets -= ties
			cost1 = tipo1 * ties
			ties = 0
		else:
			ties -= jackets
			cost1 = tipo1 * jackets
			jackets = 0
	print(cost1 + cost2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
if e > f:
	ans += min(a, d) * e
	temp = min(a, d)
	a -= temp
	d -= temp
	ans += min(b, c, d) * f
else:
	ans += min(b, c, d) * f
	temp = min(b, c, d)
	b -= temp
	d -= temp
	c -= temp
	ans += min(a, d) * e
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x = min(a, d) * e
y = min(d, b, c) * f
if e >= f:
	d -= min(a, d)
	print(min(b, c, d) * f + x)
else:
	d -= min(b, c, d)
	print(min(a, d) * e + y)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e >= f:
	g = min(a, d)
	a = a - g
	d = d - g
	if a == 0 and d != 0:
		x = min(b, c, d)
		print(e * g + f * x)
	else:
		print(g * e)
if f > e:
	h = min(b, c, d)
	b = b - h
	c = c - h
	d = d - h
	if d != 0:
		y = min(a, d)
		print(h * f + y * e)
	else:
		print(f * h)


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	mine = a
	minf = min(b, c)
	val = 0
	if e >= f:
		val += e * min(mine, d)
		d -= min(a, d)
		val += f * min(minf, d)
	if f > e:
		val += f * min(minf, d)
		d -= min(minf, d)
		val += e * min(mine, d)
	print(val)
t = 1
for i in range(t):
	main()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
c1 = 0
if e > f:
	if d > a:
		c1 = a * e + min(d - a, b, c) * f
	else:
		c1 = d * e
elif e < f:
	if min(b, c, d) != d:
		c1 = min(b, c) * f
		c1 += min(a, d - min(b, c)) * e
	else:
		c1 = f * d
elif min(d, b, c) + a < d:
	c1 = (min(d, b, c) + a) * f
else:
	c1 = d * f
print(c1)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
cost = 0
if e > f:
	ns = min(a, d)
	cost += ns * e
	if d - ns != 0:
		ns = min(b, c, d - ns)
		cost += ns * f
elif f > e:
	ns = min(b, c, d)
	cost += ns * f
	if d - ns != 0:
		ns = min(a, d - ns)
		cost += ns * e
elif min(a, d) >= min(b, c, d):
	ns = min(a, d)
	cost += ns * e
	if d - ns != 0:
		ns = min(b, c, d - ns)
		cost += ns * f
else:
	ns = min(b, c, d)
	cost += ns * e
	if d - ns != 0:
		ns = min(a, d - ns)
		cost += ns * f
print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
num = 0
while a > 0 and d > 0 or (b > 0 and c > 0 and (d > 0)):
	if (e > f or (b <= 0 or c <= 0 or d <= 0)) and (a > 0 and d > 0):
		num += e
		a -= 1
		d -= 1
	elif b > 0 and c > 0 and (d > 0):
		num += f
		b -= 1
		c -= 1
		d -= 1
print(num)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
if e > f:
	m = min(t, j)
	c = e * m
	t -= m
	j -= m
	m = min(j, v, s)
	c += f * m
	print(c)
else:
	m = min(j, v, s)
	c = f * m
	j -= m
	v -= m
	s -= m
	m = min(t, j)
	c += e * m
	print(c)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
cost_1 = int(input())
cost_2 = int(input())
ans = 0
if cost_1 > cost_2:
	ans += cost_1 * min(t, j)
	j -= min(t, j)
	ans += cost_2 * min(j, s, v)
	print(ans)
else:
	ans += cost_2 * min(j, s, v)
	j -= min(j, s, v)
	ans += cost_1 * min(t, j)
	print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
(k, l, m) = (b, c, d)
z = a
r1 = e * min(a, d)
x = min(a, d)
(a, d) = (a - x, d - x)
r2 = f * min(b, c, d)
res1 = r1 + r2
r3 = f * min(k, l, m)
y = min(k, l, m)
(k, l, m) = (k - y, l - y, m - y)
r4 = e * min(z, m)
res2 = r3 + r4
print(max(res1, res2))


def cost(x):
	cos = 0
	cos += x * e
	dn = d - x
	y = min([b, c, dn])
	cos += y * f
	return cos
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
mcost = 0
for i in range(min(a, d) + 1):
	mcost = max(mcost, cost(i))
print(mcost)


import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
sum = 0
if e > f:
	temp = min(a, d)
	d = d - temp
	sum = sum + temp * e
	if d != 0:
		temp = min(b, c, d)
		sum = sum + temp * f
else:
	temp = min(b, c, d)
	d = d - temp
	sum = sum + temp * f
	if d != 0:
		temp = min(a, d)
		sum = sum + temp * e
print(sum)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
an = aa = 0
if e > f:
	an = min(d, a)
	if an != d:
		aa = min(d - a, c, b)
	print(an * e + aa * f)
else:
	an = min(d, b, c)
	if an != d:
		aa += min(d - an, a)
	print(an * f + aa * e)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
m = 0
for i in range(d + 1):
	m1 = min(i, a) * e + min(b, c, d - i) * f
	m = max(m1, m)
print(m)


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = 1
for tt in range(t):
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	v1 = min(a, d)
	v11 = min(d - v1, b, c)
	ans1 = v1 * e + v11 * f
	v2 = min(d, b, c)
	d -= v2
	v22 = min(a, d)
	ans2 = v2 * f + v22 * e
	print(max(ans1, ans2))
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


tie = int(input())
scarves = int(input())
vest = int(input())
jacket = int(input())
cost_type1 = int(input())
cost_type2 = int(input())
no_of_suits_in_type1 = min(tie, jacket)
no_of_suits_in_type2 = min(scarves, vest, jacket)
if cost_type1 * no_of_suits_in_type1 < cost_type2 * no_of_suits_in_type1:
	total_cost_type2 = cost_type2 * no_of_suits_in_type2
	remaining_jacket = jacket - no_of_suits_in_type2
	no_of_suits_in_type1 = min(tie, remaining_jacket)
	total_cost_type1 = cost_type1 * no_of_suits_in_type1
	print(total_cost_type2 + total_cost_type1)
else:
	total_cost_type1 = cost_type1 * no_of_suits_in_type1
	remaining_jacket = jacket - no_of_suits_in_type1
	no_of_suits_in_type2 = min(scarves, vest, remaining_jacket)
	total_cost_type2 = cost_type2 * no_of_suits_in_type2
	print(total_cost_type2 + total_cost_type1)


(a, b, c, d, e, f) = (int(input()), int(input()), int(input()), int(input()), int(input()), int(input()))
cost = 0
if e >= f:
	while d > 0 and a > 0:
		cost += e
		d -= 1
		a -= 1
	while d > 0 and c > 0 and (b > 0):
		cost += f
		d -= 1
		c -= 1
		b -= 1
else:
	while d > 0 and c > 0 and (b > 0):
		cost += f
		d -= 1
		c -= 1
		b -= 1
	while d > 0 and a > 0:
		cost += e
		d -= 1
		a -= 1
print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
if f > e:
	x = min(b, c, d)
	ans += x * f
	d -= x
	if d > 0:
		y = min(a, d)
		ans += y * e
	else:
		ans += 0
elif e >= f:
	z = min(a, d)
	ans += z * e
	d -= z
	if d > 0:
		w = min(b, c, d)
		ans += w * f
	else:
		ans += 0
print(ans)


l = []
for i in range(6):
	l.append(int(input()))
a = l[0]
b = l[1]
c = l[2]
d = l[3]
e = l[4]
f = l[5]
a1 = 0
mad = min(a, d)
a1 += mad * e
a1 += min(b, c, d - mad) * f
mbcd = min(b, c, d)
a2 = mbcd * f
a2 += min(a, d - mbcd) * e
print(max(a1, a2))


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
max_val = 0
for i in range(0, j + 1):
	t1 = min(i, t) * e
	t2 = min(j - i, s, v) * f
	max_val = max(max_val, t1 + t2)
print(max_val)


tie = int(input())
scarf = int(input())
vest = int(input())
jacket = int(input())
e = int(input())
f = int(input())
cost = 0
if f > e:
	x = min(scarf, vest, jacket)
	cost += x * f
	scarf -= x
	vest -= x
	jacket -= x
	y = min(tie, jacket)
	cost += y * e
else:
	x = min(tie, jacket)
	cost += x * e
	tie -= x
	jacket -= x
	y = min(scarf, vest, jacket)
	cost += y * f
print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
S = 0
if e >= f:
	p = min(a, d)
	a -= p
	d -= p
	S += p * e
	q = min(b, c, d)
	b -= q
	c -= q
	d -= q
	S += q * f
else:
	q = min(b, c, d)
	b -= q
	c -= q
	d -= q
	S += q * f
	p = min(a, d)
	a -= p
	d -= p
	S += p * e
print(S)


z = input
(s, t) = (0, 0)
l = [0] * 6
for i in range(6):
	l[i] = int(z())
pt = min(l[1], l[2], l[3])
p = min(l[0], l[3] - pt)
p = p * l[4]
t = pt * l[5]
s1 = t + max(p, 0)
p = min(l[0], l[3])
pt = min(l[1], l[2], l[3] - p)
p = p * l[4]
t = pt * l[5]
s2 = p + max(0, t)
print(max(s1, s2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
sum = 0
if f > e:
	while 1:
		if b == 0 or c == 0 or d == 0:
			break
		b = b - 1
		c = c - 1
		d = d - 1
		sum = sum + f
	while 1:
		if a == 0 or d == 0:
			break
		a = a - 1
		d = d - 1
		sum = sum + e
else:
	while 1:
		if a == 0 or d == 0:
			break
		a = a - 1
		d = d - 1
		sum = sum + e
	while 1:
		if b == 0 or c == 0 or d == 0:
			break
		b = b - 1
		c = c - 1
		d = d - 1
		sum = sum + f
print(sum)


import sys

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	ans = 0
	if e > f:
		ans = e * min(a, d)
		x = min(a, d)
		a -= x
		d -= x
		ans += f * min(b, c, d)
		print(ans)
	else:
		ans += f * min(b, c, d)
		x = min(b, c, d)
		b -= x
		c -= x
		d -= x
		ans += e * min(a, d)
		print(ans)
get_array = lambda : list(map(int, sys.stdin.readline().split()))
get_ints = lambda : map(int, sys.stdin.readline().split())
input = lambda : sys.stdin.readline().strip()
main()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
z = d
p = min(b, c, d)
d = d - p
q = min(a, d)
x = q * e + p * f
m = min(a, z)
z = z - m
n = min(b, c, z)
y = m * e + n * f
print(max(x, y))


(a, b, c, d, e, f) = [int(input()) for _ in range(6)]
counter = 0
if e > f:
	value = min(a, d)
	d -= value
	counter += value * e
	value = min(d, b, c)
	counter += value * f
else:
	value = min(d, b, c)
	d -= value
	counter += value * f
	value = min(a, d)
	counter += value * e
print(counter)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e >= f:
	t = min(a, d)
	s1 = t * e
	d -= t
	t = min(b, c, d)
	s2 = t * f
else:
	t = min(b, c, d)
	s1 = t * f
	d -= t
	t = min(a, d)
	s2 = t * e
print(s1 + s2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
type1 = min(a, d)
type2 = min(b, c, d)
print(max(type1 * e + max(0, min(d - type1, b, c)) * f, type2 * f + min(d - type2, a) * e))


def main():
	(Tie, Sca, Ves, Jac, F, S) = [int(input()) for _ in range(6)]
	res = 0
	if F > S:
		n = min(Tie, Jac)
		res += n * F
		Jac -= n
		m = min(Sca, Ves, Jac)
		res += m * S
	else:
		n = min(Sca, Ves, Jac)
		res += n * S
		Jac -= n
		m = min(Tie, Jac)
		res += m * F
	print(res)
main()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	et = min(a, d)
	d -= et
	ft = min(d, b, c)
else:
	ft = min(b, c, d)
	d -= ft
	et = min(d, a)
print(et * e + ft * f)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
c1 = min(a, d) * e + f * min(b, c, max(0, d - a))
c2 = min(d, b, c) * f + min(max(d - min(b, c), 0), a) * e
print(max(c1, c2))


def func(a, b, c, d, e, f):
	cost = 0
	if e > f:
		if d <= a:
			return d * e
		cost += a * e
		d -= a
		x = min(b, c)
		if x >= d:
			cost += d * f
			return cost
		cost += x * f
		return cost
	else:
		x = min(b, c)
		if d <= x:
			return d * f
		cost += x * f
		d -= x
		if a >= d:
			cost += d * e
			return cost
		cost += a * e
		return cost
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
print(func(a, b, c, d, e, f))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
a1 = a
b1 = b
c1 = c
d1 = d
e1 = e
f1 = f
ans1 = 0
ans1 += min(a, d) * e
k = min(a, d)
a -= k
d -= k
ans1 += min(b, c, d) * f
ans2 = 0
ans2 += min(b1, c1, d1) * f
k = min(b1, c1, d1)
b1 -= k
c1 -= k
d1 -= k
ans2 += min(a1, d1) * e
print(max(ans1, ans2))


a = input()
a = int(a)
b = input()
b = int(b)
c = input()
c = int(c)
d = input()
d = int(d)
e = input()
e = int(e)
f = input()
f = int(f)
cost = 0
for i in range(0, d):
	oneOk = False
	twoOk = False
	if a > 0:
		oneOk = True
	if b > 0 and c > 0:
		twoOk = True
	if oneOk == False and twoOk == False:
		break
	elif oneOk == True and twoOk == True:
		if e > f:
			a = a - 1
			cost = cost + e
		else:
			b = b - 1
			c = c - 1
			cost = cost + f
	elif oneOk == True:
		a = a - 1
		cost = cost + e
	else:
		b = b - 1
		c = c - 1
		cost = cost + f
print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
type1 = min(a, d)
type2 = min(b, c, d)
tsum = 0
if e > f:
	tsum += e * type1
	tsum += f * min(b, c, d - type1)
else:
	tsum += f * type2
	tsum += e * min(a, d - type2)
print(tsum)


(a, b, c, d, e, f) = (int(input()) for i in range(6))
print(max(min(a, d) * e + min(max(d - a, 0), b, c) * f, min(d, b, c) * f + min(max(d - min(b, c), 0), a) * e))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
p = int(input())
q = int(input())
b = min(b, c)
if q > p:
	(p, q) = (q, p)
	(a, b) = (b, a)
if d < a:
	print(d * p)
else:
	d -= a
	print(a * p + min(d, b) * q)


def maxCost(a, b, c, d, e, f):
	jacketsLeft = d
	totalCost = 0
	if e > f:
		totalCost += e * min(a, d)
		jacketsLeft -= min(a, d)
		totalCost += f * min(b, c, jacketsLeft)
	else:
		totalCost += f * min(b, c, d)
		jacketsLeft -= min(b, c, d)
		totalCost += e * min(a, jacketsLeft)
	return totalCost
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
print(maxCost(a, b, c, d, e, f))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e < f:
	k = min(b, c, d)
	d = d - k
	k = k * f
	n = min(d, a)
	m = e * n
	print(k + m)
else:
	n = min(d, a)
	d = d - n
	m = e * n
	k = min(b, c, d)
	k = k * f
	print(k + m)


b = []
t = 0
for i in range(6):
	b.append(int(input()))
if b[4] > b[5]:
	if b[0] > b[3] or b[0] == b[3]:
		t = b[4] * b[3]
	else:
		t = t + b[4] * b[0]
		b[3] -= b[0]
		c = [b[1], b[2], b[3]]
		c.sort()
		t = t + b[5] * c[0]
else:
	c = [b[1], b[2], b[3]]
	c.sort()
	t = t + b[5] * c[0]
	b[3] -= c[0]
	if b[0] > b[3] or b[0] == b[3]:
		t = t + b[4] * b[3]
	else:
		t = t + b[4] * b[0]
print(t)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
m1 = a
m2 = min(b, c)
ans = 0
if e < f:
	ans = ans + f * min(m2, d)
	if d > m2:
		d = d - m2
		ans = ans + e * min(m1, d)
	else:
		d = 0
else:
	ans = ans + e * min(m1, d)
	if d > m1:
		d = d - m1
		ans = ans + f * min(d, m2)
	else:
		d = 0
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
itog = 0
for i in range(0, min(b, c, d) + 1):
	if f * i + e * min(a, d - i) > itog:
		itog = f * i + e * min(a, d - i)
print(itog)


(ties, scarves, vests, jackets, suit_1_cost, suti_2_cost) = [int(input()) for _ in range(6)]
if suit_1_cost < suti_2_cost:
	suit2_count = min(scarves, vests, jackets)
	suit1_count = min(jackets - suit2_count, ties)
else:
	suit1_count = min(ties, jackets)
	suit2_count = min(jackets - suit1_count, scarves, vests)
print(suit2_count * suti_2_cost + suit_1_cost * suit1_count)


cost = 0
ties = int(input())
scarves = int(input())
vests = int(input())
jacket = int(input())
f_cost = int(input())
s_cost = int(input())
if f_cost >= s_cost:
	if jacket >= ties:
		cost = f_cost * ties
		jacket = jacket - ties
	else:
		cost = f_cost * jacket
		jacket = 0
	tem = [jacket, scarves, vests]
	tem.sort()
	cost = cost + s_cost * tem[0]
	print(cost)
else:
	tem = [jacket, scarves, vests]
	tem.sort()
	cost = s_cost * tem[0]
	jacket = jacket - tem[0]
	if jacket >= ties:
		cost = cost + f_cost * ties
	else:
		cost = cost + f_cost * jacket
	print(cost)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x = a
ans = 0
for i in range(d + 1):
	ca = e * min(i, x)
	g = f * min(d - i, c, b)
	ans = max(ca + g, ans)
print(ans)


a = eval(input())
b = eval(input())
c = eval(input())
d = eval(input())
e = eval(input())
f = eval(input())
ans = 0
if e < f:
	ans += min(b, c, d) * f
	d -= min(b, c, d)
	ans += min(a, d) * e
else:
	ans += min(a, d) * e
	d -= min(a, d)
	ans += min(b, c, d) * f
print(ans)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
m1 = int(input())
m2 = int(input())
c = 0
f = 0
if m1 < m2:
	f = 1
cost = 0
while c < 2:
	if f == 0:
		p1 = min(t, j)
		cost += p1 * m1
		j -= p1
		f = 1
		c += 1
	elif f == 1:
		p1 = min(s, v)
		p2 = min(p1, j)
		cost += p2 * m2
		f = 0
		j -= p2
		c += 1
print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	result = min(a, d) * e
	d_rest = d - min(a, d)
	result = result + min(b, c, d_rest) * f
else:
	result = min(b, c, d) * f
	d_rest = d - min(b, c, d)
	result = result + min(a, d_rest) * e
print(result)


n_ties = int(input())
n_scarve = int(input())
n_vest = int(input())
n_jacket = int(input())
first_type = int(input())
second_type = int(input())
cost1 = min(n_ties, n_jacket) * first_type + min(n_jacket - min(n_ties, n_jacket), n_scarve, n_vest) * second_type
cost2 = min(n_scarve, n_vest, n_jacket) * second_type + min(n_jacket - min(n_scarve, n_vest, n_jacket), n_ties) * first_type
print(max(cost1, cost2))


import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
k = min(a, d)
g = min([b, c, d])
s1 = e * k + min([b, c, d - k]) * f
s2 = g * f + e * min(a, d - g)
print(max(s1, s2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e == f:
	res_1 = min(a, d)
	Num_First = res_1
	d -= res_1
	Num_Second = min(b, c, d)
	Max_Cost = e * (Num_First + Num_Second)
elif e >= f:
	res_1 = min(a, d)
	Num_First = res_1
	d -= res_1
	Num_Second = min(b, c, d)
	Max_Cost = e * Num_First + f * Num_Second
else:
	res_1 = min(b, c, d)
	Num_Second = res_1
	d -= res_1
	Num_First = min(a, d)
	Max_Cost = e * Num_First + f * Num_Second
print(Max_Cost)


(a, b, c, d, e, f) = [int(input()) for _ in range(6)]
y = min(b, c, d)
x = min(a, d)
if e < f:
	(x, y) = (y, x)
	(e, f) = (f, e)
ans = x * e + min(d - x, y) * f
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s = 0
if f >= e:
	mi = min(b, c, d)
	s += mi * f
	mi1 = min(d - mi, a)
	s += mi1 * e
else:
	mi = min(a, d)
	s += mi * e
	mi1 = min(b, c, d - mi)
	s += mi1 * f
print(s)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
count = 0
if f > e:
	mini = min(b, c, d)
	d -= mini
	count += f * mini
	w = min(a, d)
	count += e * w
	print(count)
else:
	w = min(a, d)
	d -= w
	count += e * w
	mini = min(b, c, d)
	count += f * mini
	print(count)


def cost(x, y):
	return e * x + f * y

def allow(x, y):
	return x + y <= d and 0 <= x <= a and (0 <= y <= bc)
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
bc = min(b, c)
ans = 0
if allow(0, 0) and cost(0, 0) > ans:
	ans = cost(0, 0)
if allow(0, bc) and cost(0, bc) > ans:
	ans = cost(0, bc)
if allow(a, 0) and cost(a, 0) > ans:
	ans = cost(a, 0)
if allow(d, 0) and cost(d, 0) > ans:
	ans = cost(d, 0)
if allow(0, d) and cost(0, d) > ans:
	ans = cost(0, d)
if allow(d - bc, bc) and cost(d - bc, bc) > ans:
	ans = cost(d - bc, bc)
if allow(a, d - a) and cost(a, d - a) > ans:
	ans = cost(a, d - a)
if allow(a, bc) and cost(a, bc) > ans:
	ans = cost(a, bc)
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s = 0
if f > e:
	n = min(d, c, b)
	s = n * f
	d = d - n
	m = min(d, a)
	s = s + m * e
elif e > f:
	n = min(d, a)
	s = n * e
	d = d - n
	m = min(d, b, c)
	s = s + m * f
else:
	m = min(a, d)
	n = min(b, c, d)
	if m > n:
		s = m * e
		d = d - m
		s = s + min(d, b, c) * f
	else:
		s = n * f
		d = d - n
		s = s + min(d, a) * e
print(s)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s = 0
while True:
	if e > f and min(d, a) > 0:
		s += e
		d -= 1
		a -= 1
		continue
	if min(d, b, c) > 0:
		s += f
		d -= 1
		b -= 1
		c -= 1
		continue
	if min(d, a) > 0:
		s += e
		d -= 1
		a -= 1
		continue
	break
print(s)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
w1 = min(a, d) * e
a1 = a - min(a, d)
d1 = d - min(a, d)
w2 = min(b, c, d) * f
b1 = b - min(b, c, d)
c1 = c - min(b, c, d)
d2 = d - min(b, c, d)
v1 = w1 + min(b, c, d1) * f
v2 = w2 + min(a, d2) * e
print(max(v1, v2))


import sys

def main():
	(a, b, c, d, e, f) = list(map(int, sys.stdin.read().split()))
	ans = 0
	for i in range(0, d + 1):
		t1 = min(a, i)
		t2 = min(b, c, d - i)
		if ans < t1 * e + t2 * f:
			ans = t1 * e + t2 * f
	print(ans)
main()


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
a = get_int()
b = get_int()
c = get_int()
d = get_int()
e = get_int()
f = get_int()
cost = 0
if e < f:
	m = min(b, c, d)
	cost += m * f
	d -= m
	m = min(a, d)
	cost += m * e
	print(cost)
else:
	m = min(a, d)
	cost += m * e
	d -= m
	m = min(b, c, d)
	cost += m * f
	print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
k = min(b, c, d)
x = k * f
x = x + e * min(a, d - k)
k = min(a, d)
y = k * e
y = y + f * min(b, c, d - k)
print(max(x, y))


a = []
for i in range(6):
	a.append(int(input()))
a1 = a[0]
a2 = min(a[1], a[2])
a3 = a[3]
b1 = min(a1, a3)
b2 = min(a2, a3)
cost = 0
for i in range(b1 + 1):
	cur = i * a[4] + min(a[3] - i, b2) * a[5]
	if cost < cur:
		cost = cur
print(cost)


(ties, scarves, vests, jackets, first_cost, second_cost) = [int(input()) for _ in range(6)]
if second_cost > first_cost:
	second = min(scarves, vests, jackets)
	first = min(jackets - second, ties)
else:
	first = min(jackets, ties)
	second = min(scarves, vests, jackets - first)
out = first * first_cost + second * second_cost
print(out)


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	if e > f:
		t1 = min(d, a)
		t2 = min(d - t1, b, c)
	else:
		t2 = min(d, b, c)
		t1 = min(d - t2, a)
	print(t1 * e + t2 * f)
main()


(a, b, c, d, e, f) = (int(input()) for _ in range(6))
ch1 = min(a, d)
rem1 = min(b, c, d - ch1)
ch2 = min(b, c, d)
rem2 = min(a, d - ch2)
res = max(ch1 * e + rem1 * f, ch2 * f + rem2 * e)
print(res)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
cost_f = int(input())
cost_s = int(input())
first_suit = min(t, j)
sec_suit = min(s, v, j)
ans1 = sec_suit * cost_s + min(t, abs(j - sec_suit)) * cost_f
ans2 = first_suit * cost_f + min(s, v, abs(j - first_suit)) * cost_s
print(max(ans1, ans2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s = min(a, d)
s1 = e * s + f * min(min(b, c), d - s)
s3 = min(min(b, c), d)
s4 = f * s3
s6 = e * min(a, d - s3)
print(max(s1, s4 + s6))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
sum1 = 0
if e >= f:
	min1 = min([a, d])
	d = d - min1
	sum1 = sum1 + min1 * e
	min1 = min([d, b, c])
	sum1 = sum1 + min1 * f
else:
	min1 = min([d, b, c])
	sum1 = sum1 + min1 * f
	d = d - min1
	min1 = min([a, d])
	sum1 = sum1 + min1 * e
print(sum1)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
for i in range(a + 1):
	if i > d:
		break
	tmp = 0
	tmp += i * e + min(b, c, d - i) * f
	ans = max(ans, tmp)
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
cost = 0
if f > e:
	k = min(b, c, d)
	cost = cost + f * k
	b = b - k
	c = c - k
	d = d - k
	k = min(a, d)
	cost = cost + e * k
elif f < e:
	k = min(a, d)
	cost = cost + e * k
	a = a - k
	d = d - k
	k = min(b, c, d)
	cost = cost + f * k
else:
	k = min(b, c, d)
	cost = cost + f * k
	b = b - k
	c = c - k
	d = d - k
	k = min(a, d)
	cost = cost + e * k
	cost1 = cost
	cost = 0
	k = min(a, d)
	cost = cost + e * k
	a = a - k
	d = d - k
	k = min(b, c, d)
	cost = cost + f * k
	cost2 = cost
	cost = max(cost1, cost2)
print(cost)


import os
import sys
import bisect
from math import gcd, ceil
from heapq import heapify, heappop, heappush
from io import BytesIO, IOBase

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	scarv = min(b, c)
	ans = 0
	if f > e:
		ans += f * min(scarv, d)
		z = min(scarv, d)
		scarv -= z
		d -= z
		ans += e * min(a, d)
	else:
		ans += e * min(a, d)
		z = min(a, d)
		a -= z
		d -= z
		ans += f * min(scarv, d)
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = lambda s: self.buffer.write(s.encode()) if self.writable else None

	def read(self):
		if self.buffer.tell():
			return self.buffer.read().decode('ascii')
		return os.read(self._fd, os.fstat(self._fd).st_size).decode('ascii')

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline().decode('ascii')

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

def print(*args, sep=' ', end='\n', file=sys.stdout, flush=False):
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(end)
	if flush:
		file.flush()
(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.setrecursionlimit(10000)
main()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
bc = min(b, c)
if e > f:
	ce = min(a, d)
	cf = min(bc, d - ce)
else:
	cf = min(bc, d)
	ce = min(a, d - cf)
print(e * ce + f * cf)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
price1 = 0
price2 = 0
if e > f:
	if a >= d:
		price1 = e * d
		d = d - d
		a = a - d
	else:
		price1 = e * a
		d = d - a
		a = a - a
	b1 = min(b, c)
	c1 = min(c, d)
	d1 = min(b1, c1)
	price2 = d1 * f
	print(price1 + price2)
else:
	if c < d and c < b:
		price1 = c * f
		b = b - c
		d = d - c
		c = c - c
		a1 = min(a, d)
	elif d < c and d < b:
		price1 = d * f
		c = c - d
		b = b - d
		d = d - d
	else:
		price1 = b * f
		c = c - b
		d = d - b
		b = b - b
	a1 = min(a, d)
	price2 = e * a1
	print(price1 + price2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	t = min(a, d)
	ans = t * e
	d -= t
	ans += min(b, c, d) * f
else:
	t = min(b, c, d)
	ans = t * f
	d -= t
	ans += min(a, d) * e
print(ans)


tie = int(input())
scarf = int(input())
vest = int(input())
jacket = int(input())
cost1 = int(input())
cost2 = int(input())
a = min(tie, jacket)
b = min(scarf, vest, jacket)
if cost2 >= cost1:
	jacket = jacket - b
	c = min(tie, jacket)
	ans = cost1 * c + cost2 * b
else:
	jacket = jacket - a
	c = min(scarf, vest, jacket)
	ans = cost2 * c + cost1 * a
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
k2 = min(b, c, d)
k1 = min(a, d)
a1 = a
a2 = a
b2 = b
c2 = c
b1 = b
c1 = c
d1 = d
d2 = d
a1 = a1 - k1
d1 = d1 - k1
s1 = k1 * e
k1 = min(b, c, d1)
s1 = s1 + k1 * f
b2 = b2 - k2
c2 = c2 - k2
d2 = d2 - k2
s2 = f * k2
k2 = min(a, d2)
s2 = s2 + e * k2
print(max(s1, s2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
an = 0
w = 0
if f > e:
	min1 = min(b, c, d)
	an = min1 * f
	d = d - min1
	if d > 0:
		min2 = min(a, d)
		w = e * min2
elif e >= f:
	min1 = min(a, d)
	an = min1 * e
	d = d - min1
	if d > 0:
		min2 = min(b, c, d)
		w = f * min2
print(an + w)


lis = []
for i in range(6):
	lis.append(int(input()))
a = lis[0]
b = min(lis[1], lis[2])
c = lis[3]
ans = 0
if lis[4] > lis[5]:
	ans += min(c, a) * lis[4]
	c -= min(c, a)
	ans += min(c, b) * lis[5]
else:
	ans += min(c, b) * lis[5]
	c -= min(c, b)
	ans += min(c, a) * lis[4]
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
count = 0
if e > f:
	while True:
		if a <= 0 or d <= 0:
			break
		a -= 1
		d -= 1
		count += e
	while True:
		if b <= 0 or c <= 0 or d <= 0:
			break
		b -= 1
		c -= 1
		d -= 1
		count += f
else:
	while True:
		if b <= 0 or c <= 0 or d <= 0:
			break
		b -= 1
		c -= 1
		d -= 1
		count += f
	while True:
		if a <= 0 or d <= 0:
			break
		a -= 1
		d -= 1
		count += e
print(count)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
temp_first = d - min(min(b, c), d)
first = min(min(b, c), d) * f + e * min(a, temp_first)
temp_second = d - min(a, d)
second = min(a, d) * e + f * min(min(b, c), temp_second)
total = max(first, second)
print(total)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
suit1 = min(a, d)
suit2 = min(b, c, d)
opc1 = suit1 * e + min(b, c, d - suit1) * f
opc2 = suit2 * f + min(a, d - suit2) * e
print(max(opc1, opc2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e >= f:
	k = min(a, d)
	d = d - k
	ans = k * e
	if d > 0:
		k = min(d, b, c)
		ans += f * k
if f > e:
	k = min(d, b, c)
	d = d - k
	ans = k * f
	if d > 0:
		k = min(d, a)
		ans += e * k
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
c1 = min(a, d)
c2 = min(b, c, d)
s = 0
if e > f:
	s += c1 * e
	s += min(d - c1, c2) * f
else:
	s += c2 * f
	s += min(d - c2, c1) * e
print(s)


ties = a = int(input())
m = 0
scarves = b = int(input())
vests = c = int(input())
jackets = d = int(input())
cost1 = e = int(input())
cost2 = f = int(input())
if f >= e:
	m += min(b, c, d) * f
	m += min(a, d - min(b, c, d)) * e
elif e > f:
	m += min(a, d) * e
	m += min(b, c, d - min(a, d)) * f
print(m)


import sys
ties = int(sys.stdin.readline())
scarfs = int(sys.stdin.readline())
vests = int(sys.stdin.readline())
coats = int(sys.stdin.readline())
priceForSuit1 = int(sys.stdin.readline())
priceForSuit2 = int(sys.stdin.readline())
maxSuits1 = min(ties, coats)
maxSuits2 = min(scarfs, vests, coats)
allPrice = 0
if priceForSuit1 > priceForSuit2:
	allPrice += maxSuits1 * priceForSuit1
	coats -= maxSuits1
	maxSuits2 = min(scarfs, vests, coats)
	allPrice += maxSuits2 * priceForSuit2
else:
	allPrice += maxSuits2 * priceForSuit2
	coats -= maxSuits2
	maxSuits1 = min(ties, coats)
	allPrice += maxSuits1 * priceForSuit1
print(allPrice)


(a, b, c, d, e, f) = [int(input()) for _ in range(6)]
Ai = a
Bi = min(b, c)
Ac = e
Bc = f
mv = 0
if Ac >= Bc:
	(Ai, Bi) = (Bi, Ai)
	(Ac, Bc) = (Bc, Ac)
if Bi >= d:
	print(min(Bi, d) * Bc)
	quit()
else:
	mv += Bi * Bc
	d -= Bi
	mv += min(Ai, d) * Ac
	print(mv)
	quit()


I = lambda : int(input())
(a, b, c, d, e, f) = (I(), I(), I(), I(), I(), I())
if e < f:
	x = min(b, c, d)
	print(f * x + e * min(a, d - x))
else:
	x = min(a, d)
	print(e * x + f * min(b, c, d - x))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f > e:
	t = [b, c, d]
	t.sort()
	if t[0] == d:
		print(t[0] * f)
	else:
		sum = t[0] * f
		d = abs(d - t[0])
		t = [a, d]
		t.sort()
		sum2 = t[0] * e
		print(sum + sum2)
else:
	t = [a, d]
	t.sort()
	if t[0] == d:
		print(t[0] * e)
	else:
		sum = t[0] * e
		d = abs(d - t[0])
		t = [b, c, d]
		t.sort()
		sum2 = t[0] * f
		print(sum + sum2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
result = 0
if f >= e:
	mmin = min(b, c, d)
	result += mmin * f
	result += min(a, d - mmin) * e
else:
	mmin = min(a, d)
	result += mmin * e
	result += min(b, c, d - mmin) * f
print(result)


for _ in range(1):
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	m = -1
	for x in range(a + 1):
		y = min(b, c, d - x)
		if y < 0:
			continue
		assert a >= x and b >= y and (c >= y) and (d >= x + y)
		m = max(m, x * e + y * f)
	print(m)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
cst = 0
if e >= f:
	mn = min(a, d)
	a -= mn
	d -= mn
	cst += mn * e
	mn = min(b, c, d)
	cst += mn * f
elif f > e:
	mn = min(b, c, d)
	b -= mn
	c -= mn
	d -= mn
	cst += f * mn
	mn = min(a, d)
	cst += mn * e
print(cst)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
if e < f:
	se = min(s, v, j)
	w = se * f
	j = j - se
	sew = min(j, t)
	u = sew * e
	print(w + u)
else:
	sew = min(j, t)
	u = sew * e
	j = j - sew
	se = min(s, v, j)
	w = se * f
	print(w + u)


import sys
Input = sys.stdin.readline
(ties, scarves, vests, jackets) = (int(Input()), int(Input()), int(Input()), int(Input()))
(type1, type2) = (int(Input()), int(Input()))
if type1 > type2:
	x = min(ties, jackets)
	y = min(scarves, vests, jackets - x)
	print(x * type1 + y * type2)
else:
	x = min(scarves, vests, jackets)
	y = min(ties, jackets - x)
	print(x * type2 + y * type1)


a = []
m = 0
for i in range(6):
	a.append(int(input()))
if a[-1] < a[-2]:
	t = min(a[0], a[3])
	m += a[-2] * t
	a[0] -= t
	a[3] -= t
	t = min(a[1:4])
	m += t * a[-1]
else:
	t = min(a[1:4])
	m += t * a[-1]
	a[1] -= t
	a[2] -= t
	a[3] -= t
	t = min(a[0], a[3])
	m += t * a[-2]
print(m)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s1 = min(a, d)
s2 = min(b, c, d)
hi = max(e, f)
ans = 0
if hi == e:
	a -= s1
	d -= s1
	ans += hi * s1
	tmp = min(b, c, d)
	ans += f * tmp
elif hi == f:
	b -= s2
	c -= s2
	d -= s2
	ans += hi * s2
	tmp = min(a, d)
	ans += e * tmp
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
mc = 0
if e > f:
	t1 = min(a, d)
	t2 = min(b, c, d - t1)
	mc = e * t1 + f * t2
else:
	t2 = min(b, c, d)
	t1 = min(a, d - t2)
	mc = e * t1 + f * t2
print(mc)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
cost = 0
if f >= e:
	ftype = min(b, c, d)
	b -= ftype
	c -= ftype
	d -= ftype
	etype = min(a, d)
	print(etype * e + f * ftype)
else:
	etype = min(a, d)
	d -= etype
	ftype = min(b, c, d)
	print(e * etype + f * ftype)


from sys import stdin, stdout
ties = int(stdin.readline())
scarves = int(stdin.readline())
vests = int(stdin.readline())
jackets = int(stdin.readline())
costTieJacketSuit = int(stdin.readline())
costScarfVestJacketSuit = int(stdin.readline())

def computeCost(ties, scarves, vests, jackets, costTieJacketSuit, costScarfVestJacketSuit):
	if costScarfVestJacketSuit > costTieJacketSuit:
		maxSuits = min([scarves, vests, jackets])
		jackets -= maxSuits
		totalCost = maxSuits * costScarfVestJacketSuit
		maxSuits = min([ties, jackets])
		jackets -= maxSuits
		return totalCost + maxSuits * costTieJacketSuit
	else:
		maxSuits = min([ties, jackets])
		jackets -= maxSuits
		totalCost = maxSuits * costTieJacketSuit
		maxSuits = min([scarves, vests, jackets])
		jackets -= maxSuits
		return totalCost + maxSuits * costScarfVestJacketSuit
stdout.write(str(computeCost(ties, scarves, vests, jackets, costTieJacketSuit, costScarfVestJacketSuit)) + '\n')


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
for i in range(100):
	pass
for i in range(100):
	pass
if e >= f:
	ans = e * min(a, d)
	k = min(a, d)
	a -= k
	d -= k
	ans += f * min(b, c, d)
	print(ans)
else:
	ans = f * min(b, c, d)
	k = min(b, c, d)
	b -= k
	c -= k
	d -= k
	ans += e * min(a, d)
	print(ans)
for i in range(100):
	pass


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	fst_type = min(a, d)
	d -= fst_type
	snd_type = min(b, c, d)
else:
	snd_type = min(b, c, d)
	d -= snd_type
	fst_type = min(a, d)
print(fst_type * e + snd_type * f)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
c1 = int(input())
c2 = int(input())
cost1 = 0
cost2 = 0
suit1 = min(ties, jackets)
suit2 = min(scarves, min(vests, jackets))
cost1 += suit2 * c2
suit1 = min(ties, jackets - suit2)
cost1 += suit1 * c1
suit1 = min(ties, jackets)
suit2 = min(scarves, min(vests, jackets))
cost2 += suit1 * c1
suit2 = min(scarves, min(vests, jackets - suit1))
cost2 += suit2 * c2
print(max(cost1, cost2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
if e > f:
	items = min(a, d)
	d -= items
	ans += e * items
	items = min(d, b, c)
	ans += f * items
elif f > e:
	items = min(d, b, c)
	ans += f * items
	d -= items
	items = min(a, d)
	ans += e * items
else:
	ans += e * min(d, a + min(b, c))
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
j = int(input())
k = int(input())
if k > j:
	r = min(b, c, d)
	l = d - r
	paise = r * k
	y = min(a, l)
	paise += y * j
else:
	r = min(a, d)
	l = d - r
	paise = r * j
	y = min(b, c, l)
	paise += y * k
print(paise)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
(costA, costB) = (0, 0)
if e > f:
	lstA = min(a, d)
	costA = e * lstA
	(a, d) = (a - lstA, d - lstA)
	lstB = min(b, c, d)
	costB = f * lstB
else:
	lstB = min(b, c, d)
	costB = f * lstB
	(b, c, d) = (b - lstB, c - lstB, d - lstB)
	lstA = min(a, d)
	costA = e * lstA
print(costA + costB)


(a, b, c, d, e, f) = (int(input().strip()), int(input().strip()), int(input().strip()), int(input().strip()), int(input().strip()), int(input().strip()))
maxCost = 0
for i in range(a + 1):
	if i > d:
		break
	cost = e * i
	cost += f * min(d - i, b, c)
	if cost > maxCost:
		maxCost = cost
print(maxCost)


ties = int(input())
scarf = int(input())
vest = int(input())
jacket = int(input())
s1 = int(input())
s2 = int(input())
price1 = 0
price2 = 0
if max(s1, s2) == s2:
	price1 = s2 * min(vest, scarf, jacket)
	if ties > 0 and jacket > 0:
		jacket -= min(vest, scarf, jacket)
		price1 += s1 * min(ties, jacket)
	print(price1)
else:
	price2 = s1 * min(ties, jacket)
	if vest > 0 and scarf > 0 and (jacket > 0):
		jacket -= min(ties, jacket)
		price2 += s2 * min(scarf, vest, jacket)
	print(price2)


m = []
for k in range(6):
	c = int(input())
	m.append(c)
(a, b, c, d, e, f) = [m[i] for i in range(6)]
mino = min(a, d)
mint = min(b, c, d)
if e <= f and d >= mint:
	tot = mint * f + min(d - mint, a) * e
elif f < e and d >= mino:
	tot = mino * e + min(d - mino, mint) * f
print(tot)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
total_ = 0
if e > f:
	temp = min(a, d)
	total_ += e * temp
	a -= temp
	d -= temp
	temp1 = min(b, c, d)
	total_ += f * temp1
elif f >= e:
	temp = min(b, c, d)
	total_ += f * temp
	b -= temp
	c -= temp
	d -= temp
	temp1 = min(a, d)
	total_ += temp1 * e
print(total_)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
(x, y, z, q) = (a, b, c, d)
m = min(x, q)
q -= m
am = m * e
m1 = min(y, z, q)
am += m1 * f
m = min(b, c, d)
d -= m
m1 = min(a, d)
am2 = m1 * e + m * f
print(max(am, am2))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from math import sqrt, floor, factorial, gcd, log
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from math import gcd
from bisect import bisect
input = lambda : sys.stdin.readline().rstrip('\r\n')
read = lambda : list(map(int, input().strip().split(' ')))

def solve():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	one = min([a, d])
	two = min([b, c, d])
	three = e * one + f * min([b, c, d - one])
	four = f * two + e * min([a, d - two])
	print(max(e * one, f * two, three, four))
solve()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	sets_t1 = min(a, d)
	a -= sets_t1
	d -= sets_t1
	sets_t2 = min(b, c, d)
else:
	sets_t2 = min(b, c, d)
	b -= sets_t2
	c -= sets_t2
	d -= sets_t2
	sets_t1 = min(a, d)
print(sets_t1 * e + sets_t2 * f)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
o1 = 0
o2 = 0
if e > f:
	t1 = min(a, d)
	o1 += t1
	d -= t1
	o2 += min(b, c, d)
else:
	t2 = min(b, c, d)
	o2 += t2
	d -= t2
	o1 += min(a, d)
print(e * o1 + f * o2)


arr = []
for _ in range(6):
	arr.append(int(input()))
tie = arr[0]
scarves = arr[1]
vests = arr[2]
jackets = arr[3]
e = arr[4]
f = arr[5]
ans = 0
if e > f:
	tmp = min(tie, jackets)
	tie -= tmp
	jackets -= tmp
	ans += e * tmp
	tmp = max(0, min(scarves, vests, jackets))
	ans += f * tmp
elif e <= f:
	tmp = max(0, min(scarves, vests, jackets))
	ans += f * tmp
	jackets -= tmp
	tmp = max(0, min(tie, jackets))
	ans += e * tmp
print(ans)


from collections import defaultdict
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
res = 0
m = min(b, c, d)
res += m * f
n = min(a, d - m)
res += n * e
res2 = 0
n = min(a, d)
res2 += n * e
m = min(b, c, d - n)
res2 += m * f
print(max(res, res2))


t = int(input())
s = int(input())
v = int(input())
j = int(input())
s1 = int(input())
s2 = int(input())
cost = 0
if s1 > s2:
	consumed = min(t, j)
	cost = consumed * s1
	if j - consumed > 0:
		j -= consumed
		consumed = min(j, min(v, s))
		cost += consumed * s2
else:
	consumed = min(j, min(v, s))
	cost += consumed * s2
	j -= consumed
	if j > 0:
		cost += min(j, t) * s1
print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())

def min(ints):
	m = float('inf')
	for i in ints:
		if i < m:
			m = i
	return m
E = 0
F = 0
if e > f:
	E = min([a, d])
	F = min([b, c, d - E])
else:
	F = min([b, c, d])
	E = min([a, d - F])
print(e * E + f * F)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
if e > f:
	n1 = min(a, d)
	ans += n1 * e
	a -= n1
	d -= n1
	n2 = min(b, min(c, d))
	ans += n2 * f
else:
	n1 = min(b, min(c, d))
	ans += n1 * f
	b -= n1
	c -= n1
	d -= n1
	n2 = min(a, d)
	ans += n2 * e
print(ans)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
tJ = int(input())
svJ = int(input())
total = 0
if tJ == svJ:
	ptJ = min([jackets, ties])
	psvJ = min([jackets, scarves, vests])
	q = max([ptJ, psvJ])
	total = total + q * tJ
	jackets = jackets - q
	if jackets > 0:
		total = total + min([jackets, ptJ, psvJ]) * tJ
elif tJ > svJ:
	q = min(jackets, ties)
	total = total + q * tJ
	x = min([jackets - q, vests, scarves])
	x = x * svJ
	total = total + x
elif tJ < svJ:
	q = min(jackets, vests, scarves)
	total = total + q * svJ
	x = min([jackets - q, ties])
	x = x * tJ
	total = total + x
print(total)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
c1 = int(input())
c2 = int(input())
cost = 0
(t1, s1, v1, j1) = (t, s, v, j)
minamt = min(s1, v1, j1)
cost = minamt * c2
(s1, v1, j1) = (s1 - minamt, v1 - minamt, j1 - minamt)
minamt = min(t1, j1)
cost += minamt * c1
cost1 = 0
(t1, s1, v1, j1) = (t, s, v, j)
minamt = min(t1, j1)
cost1 = minamt * c1
(t1, j1) = (t1 - minamt, j1 - minamt)
minamt = min(s1, v1, j1)
cost1 += minamt * c2
print(max(cost1, cost))


tie = int(input())
scar = int(input())
vest = int(input())
jack = int(input())
first = int(input())
second = int(input())
if second > first:
	m0 = min(scar, vest, jack)
	price = m0 * second
	scar -= m0
	vest -= m0
	jack -= m0
	m0 = min(jack, tie)
	price += m0 * first
	print(price)
else:
	m0 = min(jack, tie)
	price = m0 * first
	jack -= m0
	tie -= m0
	m0 = min(scar, vest, jack)
	price += m0 * second
	print(price)


(ties, scarves, vests, jackets, first, second) = (int(input()) for i in range(6))
total = 0
if first > second:
	total += min(ties, jackets) * first
	spent = min(ties, jackets)
	ties -= spent
	jackets -= spent
	total += min(scarves, vests, jackets) * second
else:
	total += min(scarves, vests, jackets) * second
	spent = min(scarves, vests, jackets)
	scarves -= spent
	vests -= spent
	jackets -= spent
	total += min(ties, jackets) * first
print(total)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
cost1 = 0
cost = 0
p = a
q = b
r = c
s = d
while b != 0 and c != 0 and (d != 0):
	b -= 1
	c -= 1
	d -= 1
	cost1 = cost1 + f
while d != 0 and a != 0:
	a -= 1
	d -= 1
	cost1 = cost1 + e
while p != 0 and s != 0:
	s -= 1
	p -= 1
	cost = cost + e
while s != 0 and r != 0 and (q != 0):
	q -= 1
	r -= 1
	s -= 1
	cost = cost + f
print(max(cost, cost1))


tie = int(input())
scarve = int(input())
vest = int(input())
jack = int(input())
one = int(input())
two = int(input())
s = 0
if one >= two:
	if tie >= jack:
		s = jack * one
		jack = 0
	else:
		s = tie * one
		jack = jack - tie
	if scarve <= vest and scarve <= jack:
		s = s + scarve * two
	elif jack <= scarve and jack <= vest:
		s = s + jack * two
	else:
		s = s + vest * two
else:
	if scarve <= vest and scarve <= jack:
		s = scarve * two
		jack = jack - scarve
	elif jack <= scarve and jack <= vest:
		s = jack * two
		jack = 0
	else:
		s = vest * two
		jack = jack - vest
	if tie >= jack:
		s = s + jack * one
	else:
		s = s + tie * one
print(s)


inp = input
a = int(inp())
b = int(inp())
c = int(inp())
d = int(inp())
e = int(inp())
f = int(inp())
mn1 = min(b, c, d)
a1 = f * mn1
rj = d - mn1
mn2 = min(a, rj)
a1 += e * mn2
mn1 = min(a, d)
a2 = e * mn1
rj = d - mn1
mn2 = min(b, c, rj)
a2 += f * mn2
print(max(a1, a2))


a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
d = int(input().strip())
e = int(input().strip())
f = int(input().strip())
max1 = a
max2 = min(b, c)
if e > f:
	print(min(max1, d) * e + min(d - min(max1, d), max2) * f)
elif f > e:
	print(min(max2, d) * f + min(d - min(max2, d), max1) * e)
elif max1 > max2:
	print(min(max1, d) * e + min(d - min(max1, d), max2) * f)
else:
	print(min(max2, d) * f + min(d - min(max2, d), max1) * e)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
pro = 0
if j == t + min(s, v):
	pro += e * t + f * min(s, v)
elif e > f:
	to = min(j, t)
	pro += e * to
	j -= to
	pro += f * min(j, min(s, v))
elif e < f:
	to = min(j, min(s, v))
	pro += f * to
	j -= to
	pro += e * min(j, t)
elif e == f:
	pro += min(j, t + min(s, v)) * e
print(pro)


tie = int(input())
scarf = int(input())
vest = int(input())
jacket = int(input())
suit1cost = int(input())
suit2cost = int(input())
(maxcost1, maxcost2) = (0, 0)
x = min(tie, jacket)
maxcost1 = suit1cost * x
y = min(jacket - x, vest, scarf)
maxcost1 += suit2cost * y
x = min(jacket, vest, scarf)
maxcost2 = x * suit2cost
y = min(jacket - x, tie)
maxcost2 += y * suit1cost
print(max(maxcost1, maxcost2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f >= e:
	min1 = min(b, c, d)
	b = b - min1
	c = c - min1
	d = d - min1
	res1 = min1 * f
	res2 = min(a, d) * e
	print(res1 + res2)
else:
	min1 = min(a, d)
	a = a - min1
	d = d - min1
	res1 = min1 * e
	res2 = min(b, c, d) * f
	print(res1 + res2)


def solve(a, b, c, d, e, f):
	x = a + d
	y = b + c + d
	s = 0
	if f > e:
		s = min(b, c, d)
		d -= s
		s = f * s + e * min(a, d)
	else:
		s = min(a, d)
		d -= s
		s = e * s + f * min(b, c, d)
	return s

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	print(solve(a, b, c, d, e, f))
main()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	eterm = min(a, d)
	fterm = min(d - eterm, b, c)
	print(eterm * e + fterm * f)
else:
	fterm = min(d, b, c)
	eterm = min(d - fterm, a)
	print(eterm * e + fterm * f)


l = []
for i in range(6):
	l.append(int(input()))
(a, b, c, d, e, f) = (l[0], l[1], l[2], l[3], l[4], l[5])
cost = 0
if e > f:
	if a > d:
		cost += d * e
	else:
		cost += a * e
		d -= a
		cost += min(b, c, d) * f
elif min(b, c) > d:
	cost += d * f
else:
	cost += min(b, c, d) * f
	d -= min(b, c)
	cost += min(a, d) * e
print(cost)


from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))

def solve():
	a = ri()
	b = ri()
	c = ri()
	d = ri()
	e = ri()
	f = ri()
	orig = [a, b, c, d]
	t1 = 0
	m = min(a, d)
	t1 += m * e
	a -= m
	d -= m
	t1 += f * min(b, c, d)
	(a, b, c, d) = orig
	t2 = 0
	m = min(b, c, d)
	t2 += m * f
	b -= m
	c -= m
	d -= m
	t2 += e * min(a, d)
	print(max(t1, t2))
mode = 's'
if mode == 'T':
	t = ri()
	for i in range(t):
		solve()
else:
	solve()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
sum1 = sum2 = 0
if e > f:
	if d > a:
		sum1 += a * e
		d -= a
	else:
		sum1 += d * e
		d = 0
	if d > 0:
		sum2 += int(min(d, b, c)) * f
	print(sum1 + sum2)
elif f >= e:
	r = int(min(b, c))
	if d > r:
		d -= r
		sum1 += r * f
	else:
		sum1 += d * f
		d = 0
	if d > 0:
		sum2 += int(min(d, a)) * e
	print(sum1 + sum2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
if f > e:
	fs = min(b, c, d)
	c -= fs
	b -= fs
	d -= fs
	ans += f * fs
	es = min(a, d)
	ans += es * e
else:
	es = min(a, d)
	d -= es
	ans += es * e
	fs = min(b, c, d)
	ans += f * fs
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
res = 0
for i in range(d + 1):
	x1 = i
	x2 = d - i
	tmp1 = min(x1, a) * e
	tmp2 = min(x2, b, c) * f
	res = max(res, tmp1 + tmp2)
print(res)


import sys

def solution():
	ties = int(input())
	scarves = int(input())
	vests = int(input())
	jackets = int(input())
	first = int(input())
	second = int(input())
	suit1 = ([], 0)
	suit2 = ([], 0)
	indx = 1
	if first > second:
		suit1 = ([ties, jackets], first)
		suit2 = ([scarves, vests, jackets], second)
		indx = 2
	else:
		suit1 = ([scarves, vests, jackets], second)
		suit2 = ([ties, jackets], first)
	minNum = min(suit1[0])
	result = minNum * suit1[1]
	jackets -= minNum
	suit2[0][indx] = jackets
	minNum = min(suit2[0])
	result += minNum * suit2[1]
	print(result)
solution()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
if e >= f:
	x = min(a, d)
	ans = ans + e * x
	a = a - x
	d = d - x
	y = min(b, c, d)
	ans = ans + f * y
	print(ans)
elif f > e:
	y = min(b, c, d)
	ans = ans + f * y
	b = b - y
	c = c - y
	d = d - y
	x = min(a, d)
	ans = ans + e * x
	print(ans)


(a, b, c, d, e, f) = map(int, [input() for _ in range(6)])
s = 0
if e > f:
	s = min(a, d) * e
	d -= min(a, d)
	s += min(b, c, d) * f
else:
	s = min(b, c, d) * f
	d -= min(b, c, d)
	s += min(a, d) * e
print(s)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x = 0
if f > e:
	z = min(b, c, d)
	x = z * f
	d -= z
	if d > 0:
		v = min(a, d)
		x += v * e
else:
	q = min(a, d)
	x += q * e
	d -= q
	if d > 0:
		n = min(b, c, d)
		x += n * f
print(x)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	n1 = min(a, d)
	d = d - n1
	n2 = min(b, c, d)
	tot = n1 * e + n2 * f
else:
	n2 = min(d, b, c)
	d -= n2
	n1 = min(d, a)
	tot = n2 * f + n1 * e
print(tot)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
max1 = min(a, d)
max2 = min([b, c, d])
case1 = min([d - max1, b, c])
case2 = min([d - max2, a])
ans1 = max1 * e + case1 * f
ans2 = max2 * f + case2 * e
print(max(ans1, ans2))


l = [int(input()) for i in range(6)]
ans = 0
if l[5] > l[4]:
	while l[1] > 0 and l[2] > 0 and (l[3] > 0):
		l[1] -= 1
		l[2] -= 1
		l[3] -= 1
		ans += l[5]
	while l[0] > 0 and l[3] > 0:
		l[0] -= 1
		l[3] -= 1
		ans += l[4]
else:
	while l[0] > 0 and l[3] > 0:
		l[0] -= 1
		l[3] -= 1
		ans += l[4]
	while l[1] > 0 and l[2] > 0 and (l[3] > 0):
		l[1] -= 1
		l[2] -= 1
		l[3] -= 1
		ans += l[5]
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x = max(e, f)
if x == e:
	z = min(d, a)
	if d - z > 0:
		print(z * e + min(d - z, b, c) * f)
	else:
		print(z * e)
else:
	z = min(d, b, c)
	if d - z > 0:
		print(z * f + min(d - z, a) * e)
	else:
		print(z * f)


def suit(n):
	ret = C[4] * n + min(C[1], C[2], C[3] - n) * C[5]
	return ret
C = []
for i in range(6):
	C.append(int(input()))
ans = 0
for i in range(min(C[0], C[3]) + 1):
	ans = max(ans, suit(i))
print(ans)


items = [int(input()) for x in range(4)]
(e, f) = (int(input()), int(input()))
g2 = min(items[1:])
g1 = min([items[0], items[-1]])
ans = 0
for i in range(g1 + 1):
	first = i * e
	second = min(g2, items[-1] - i) * f
	if first + second > ans:
		ans = first + second
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
cost = 0
costa = 0
if f > e:
	if b <= c and b <= d:
		cost += b * f
		d -= b
		if d <= a:
			cost += e * d
		else:
			cost += e * a
	elif c <= b and c <= d:
		cost += c * f
		d -= c
		if d <= a:
			cost += e * d
		else:
			cost += e * a
	elif d <= c and d <= b:
		cost += d * f
elif d <= a:
	cost += d * e
else:
	cost += a * e
	d -= a
	if b <= c and b <= d:
		cost += b * f
	elif c <= b and c <= d:
		cost += c * f
	elif d <= c and d <= b:
		cost += d * f
print(cost)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
suit1Prices = int(input())
suit2Prices = int(input())
totalSales = 0
if suit1Prices > suit2Prices:
	low = min(ties, jackets)
	totalSales += low * suit1Prices
	ties -= low
	jackets -= low
	if scarves >= 1 and vests >= 1 and (jackets >= 1):
		low = min(scarves, vests, jackets)
		totalSales += low * suit2Prices
		scarves -= low
		vests -= low
		jackets -= low
if suit2Prices >= suit1Prices:
	low = min(scarves, vests, jackets)
	totalSales += low * suit2Prices
	scarves -= low
	vests -= low
	jackets -= low
	if ties >= 1 and jackets >= 1:
		low = min(ties, jackets)
		totalSales += low * suit1Prices
		ties -= low
		jackets -= low
print(totalSales)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
suit1 = 0
suit2 = 0
if e > f:
	suit1 = min(a, d)
	a = a - suit1
	d = d - suit1
	if d > 0:
		suit2 = min(b, c, d)
else:
	suit2 = min(b, c, d)
	d = d - suit2
	if d > 0:
		suit1 = min(a, d)
print(e * suit1 + f * suit2)


(a, b, c, d, e, f) = (int(input()), int(input()), int(input()), int(input()), int(input()), int(input()))
if a + min(b, c) <= d:
	print(a * e + min(b, c) * f)
elif e > f:
	first = min(a, d)
	d = d - first
	print(first * e + min(d, b, c) * f)
else:
	second = min(b, c, d)
	d = d - second
	print(second * f + min(d, a) * e)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	m = min(a, d)
	cost1 = m * e
	d = d - m
	cost2 = min(b, c, d) * f
else:
	m = min(b, c, d)
	cost1 = m * f
	d = d - m
	cost2 = min(a, d) * e
print(cost1 + cost2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
(suma1, suma2) = (0, 0)
if e >= f:
	suma1 += min(a, d) * e
	d -= min(a, d)
	suma1 += min(b, c, d) * f
	if e > f:
		print(suma1)
if e <= f:
	suma2 += min(b, c, d) * f
	d -= min(b, c, d)
	suma2 += min(a, d) * e
	if e < f:
		print(suma2)
if e == f:
	print(max(suma1, suma2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e >= f:
	if a > d:
		print(str(d * e))
	else:
		print(str(a * e + min(d - a, b, c) * f))
elif min(b, c) > d:
	print(str(d * f))
else:
	print(str(min(b, c) * f + min(d - min(b, c), a) * e))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
p = 0
if e > f:
	x = min(a, d)
	d -= x
	p += e * x
	p += min(b, c, d) * f
else:
	x = min(b, c, d)
	d -= x
	p += f * x
	p += e * min(a, d)
print(p)


import sys
input = sys.stdin.buffer.readline
(a, b, c, d, e, f) = [int(input()) for i in range(6)]
if e > f:
	sold_1 = min(a, d)
	d -= sold_1
	sold_2 = min(b, c, d)
else:
	sold_2 = min(b, c, d)
	d -= sold_2
	sold_1 = min(a, d)
print(sold_1 * e + sold_2 * f)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
e = int(input())
f = int(input())
ans = 0
if f > e:
	ans += min(scarves, vests, jackets) * f
	jackets -= min(scarves, vests, jackets)
	ans += min(ties, jackets) * e
else:
	ans += min(ties, jackets) * e
	jackets -= min(ties, jackets)
	ans += min(scarves, vests, jackets) * f
print(ans)


x = []
for _ in range(6):
	x.append(int(input()))
suit2 = min(x[1], x[2])
if x[0] + suit2 <= x[3]:
	print(x[4] * x[0] + x[5] * suit2)
elif x[4] >= x[5]:
	print(x[4] * min(x[3], x[0]) + max(0, x[5] * (x[3] - x[0])))
else:
	print(x[5] * min(suit2, x[3]) + max(0, x[4] * (x[3] - suit2)))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	val = min(a, d)
	d -= val
	val1 = min(b, c, d)
	print(val * e + val1 * f)
else:
	val = min(b, c, d)
	d -= val
	val1 = min(a, d)
	print(val * f + val1 * e)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s1 = min(a, d)
s2 = min(b, c, d)
t1 = e * s1
t2 = f * s2
t3 = s2 * f + min(max(d - s2, 0), s1) * e
t4 = s1 * e + min(max(d - s1, 0), s2) * f
print(max(t1, t2, t3, t4))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	sum = 0
	sum += min(a, d) * e
	if d - a > 0:
		sum += min(b, c, d - a) * f
	print(sum)
elif f > e:
	sum = 0
	sum += min(b, c, d) * f
	if d - min(b, c) > 0:
		sum += min(a, d - min(b, c)) * e
	print(sum)
elif f == e:
	sum = 0
	sum += min(a, d) * e
	if d - a > 0:
		sum += min(b, c, d - a) * f
	print(sum)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e <= f:
	if b <= c and b <= d:
		x = b
		d = d - b
	elif c <= b and c <= d:
		x = c
		d = d - c
	else:
		x = d
		d = 0
	y = x * f
	if d != 0:
		if d >= a:
			d = d - a
			x = a
			y = y + x * e
			print(y)
		else:
			x = d
			y = y + x * e
			print(y)
	else:
		print(y)
else:
	if d >= a:
		x = a
		d = d - a
	else:
		x = d
		d = 0
	y = x * e
	if d != 0:
		if b <= c and b <= d:
			x = b
			d = d - b
			y = y + x * f
			print(y)
		elif c <= b and c <= d:
			x = c
			d = d - c
			y = y + x * f
			print(y)
		else:
			x = d
			y = y + x * f
			print(y)
	else:
		print(y)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
sum = 0
if e < f:
	s1 = min(b, c, d)
	sum += s1 * f
	if d > s1:
		s2 = min(a, d - s1)
		sum += s2 * e
else:
	s1 = min(a, d)
	sum += s1 * e
	if d > s1:
		s2 = min(b, c, d - s1)
		sum += s2 * f
print(sum)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f > e:
	suit2 = min(b, c, d)
	suit2p = suit2 * f
	suit1 = min(a, d - suit2) * e
	print(suit2p + suit1)
else:
	suit1 = min(a, d)
	suit1p = suit1 * e
	suit2 = min(b, c, d - suit1) * f
	print(suit2 + suit1p)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
cost1 = int(input())
cost2 = int(input())
count1 = min(ties, jackets)
count2 = min(scarves, vests, jackets)
maxCost = 0
for i in range(jackets + 1):
	jackets1 = i
	jackets2 = jackets - i
	cost = min(count1, jackets1) * cost1 + min(count2, jackets2) * cost2
	maxCost = max(maxCost, cost)
print(maxCost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
E = 0
F = 0
if e > f:
	E = min(a, d)
	F = min(b, c, d - E)
else:
	F = min(b, c, d)
	E = min(a, d - F)
print(e * E + f * F)


def sol():
	A = []
	for i in range(6):
		A.append(int(input()))
	(t, s, v, j, e, f) = map(int, A)
	p = 0
	if e > f:
		if t > j:
			p = j * e
			j = 0
		else:
			p = t * e
			j = j - t
		p = p + min(s, v, j) * f
	else:
		q = min(s, v, j)
		j = j - q
		p = f * q + min(t, j) * e
	print(p)
sol()


t = int(input())
s = int(input())
v = int(input())
j = int(input())
s1 = int(input())
s2 = int(input())
ans = 0
if s1 > s2:
	p = j - min(t, j)
	ans += s1 * min(t, j) + s2 * min(p, s, v)
else:
	p = j - min(s, v, j)
	ans += s2 * min(s, v, j) + s1 * min(p, t)
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f > e:
	s = min(b, c, d)
	v = s * f
	d = d - s
	s = min(d, a)
	v = v + s * e
else:
	s = min(a, d)
	v = s * e
	d = d - s
	s = min(b, c, d)
	v = v + s * f
print(v)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
first_cost = int(input())
second_cost = int(input())
if second_cost > first_cost:
	second = min(scarves, vests, jackets)
	first = min(jackets - second, ties)
else:
	first = min(jackets, ties)
	second = min(scarves, vests, jackets - first)
out = first * first_cost + second * second_cost
print(out)


def mi():
	return map(int, input().split())

def li():
	return list(mi())

def ii():
	return int(input())

def si():
	return input()
a = ii()
b = ii()
c = ii()
d = ii()
e = ii()
f = ii()
s = 0
if e >= f:
	a = min(a, d)
	s += a * e
	d = d - a
	b = min(b, c)
	b = min(b, d)
	s += b * f
	print(s)
else:
	b = min(b, c)
	b = min(b, d)
	s += b * f
	d = d - b
	a = min(a, d)
	s += a * e
	print(s)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
count = 0
if f > e:
	if b < c and b < d:
		count = b * f
		d = d - b
		if d < a:
			count = count + d * e
		else:
			count = count + a * e
	elif c < d:
		count = c * f
		d = d - c
		if d < a:
			count = count + d * e
		else:
			count = count + a * e
	else:
		count = d * f
elif d > a:
	count = a * e
	d = d - a
	if b < c and b < d:
		count = b * f + count
	elif c < d:
		count = c * f + count
	else:
		count = d * f + count
else:
	count = d * e
print(count)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
f = int(input())
e = int(input())
price = 0
if f > e:
	f_c = min(t, j)
	price += f_c * f
	j -= f_c
	e_c = min(s, v, j)
	price += e_c * e
	print(price)
else:
	e_c = min(s, v, j)
	price += e_c * e
	j -= e_c
	f_c = min(t, j)
	price += f_c * f
	print(price)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
co = 0
if f > e:
	mi = min(b, c, d)
	d -= mi
	mi2 = min(a, d)
	co = mi * f + mi2 * e
elif f < e:
	mi = min(a, d)
	d -= mi
	mi2 = min(b, c, d)
	co = mi * e + mi2 * f
else:
	m1 = min(a, d)
	d -= m1
	m2 = min(b, c, d)
	co = m1 * e + m2 * f
print(co)


import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
cao = min(b, c)
total = min(d, a + cao)
cao = min(total, cao)
a = min(total, a)
maxi = 0
for i in range(0, a + 1):
	if 0 <= total - i <= cao:
		if (total - i) * f + i * e > maxi:
			maxi = (total - i) * f + i * e
print(maxi)


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	ans1 = min(a, d) * e
	if a < d:
		ans1 += min(d - a, min(b, c)) * f
	ans2 = min(d, min(b, c)) * f
	if min(d, min(b, c)) < d:
		ans2 += min(a, d - min(d, min(b, c))) * e
	ans = max(ans1, ans2)
	print(ans)
main()


from collections import Counter, deque, defaultdict, OrderedDict, namedtuple
from bisect import bisect_left, bisect_right, insort
from math import sqrt, ceil, floor, factorial, gcd
from sys import stdin
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x = min(a, d)
y = min(b, c, d - x)
ans = x * e + y * f
x = min(b, c, d)
y = min(a, d - x)
ans = max(ans, x * f + y * e)
print(ans)


import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
l = 0
r = d
sl = min(a, l) * e + min(b, c, d - l) * f
sr = min(a, r) * e + min(b, c, d - r) * f
while l + 1 != r and l != r:
	k = (l + r) / 2
	kp = math.ceil(k + 0.1)
	km = math.floor(k - 0.1)
	sk = min(a, k) * e + min(b, c, d - k) * f
	skp = min(a, kp) * e + min(b, c, d - kp) * f
	skm = min(a, km) * e + min(b, c, d - km) * f
	if skp <= sk and sk <= skm:
		r = math.ceil(k)
		sr = sk
	elif skp >= sk and sk >= skm:
		l = math.floor(k)
		sl = sk
	else:
		sl = sk
		break
print(int(max(sl, sr)))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
h = []
for i in range(0, d + 1):
	h.append(min(a, i) * e + min(b, c, d - i) * f)
print(max(h))


def price(a, b, c, d, e, f):
	(ad, bc) = (min(a, d), min(b, c))
	bcd = min(bc, d)
	if e < f:
		return f * bcd + min(d - bcd, a) * e
	return e * ad + f * min(d - ad, bc)
(a, b, c, d, e, f) = [int(input()) for _ in range(6)]
print(price(a, b, c, d, e, f))


def fr(a, b, c, d, e, f):
	if e > f:
		if d > a:
			return min(d, a) * e + min(d - a, b, c) * f
		else:
			return min(d, a) * e
	elif min(d, b, c) == d:
		return min(b, c, d) * f
	else:
		return min(b, c) * f + min(d - min(b, c), a) * e
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
print(fr(a, b, c, d, e, f))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f > e:
	f_min = min(b, c, d)
	f_cost = f_min * f
	b = b - f_min
	c = c - f_min
	d = d - f_min
	e_min = min(a, d)
	e_cost = e_min * e
	total = f_cost + e_cost
	print(total)
else:
	e_min = min(a, d)
	e_cost = e_min * e
	a = a - e_min
	d = d - e_min
	f_min = min(b, c, d)
	f_cost = f_min * f
	total = f_cost + e_cost
	print(total)


a = int(input())
c = int(input())
d = int(input())
j = int(input())
e = int(input())
f = int(input())
cost = 0
m = min(c, d)
c = m
d = m
while j > 0:
	if e >= f:
		if j <= a:
			cost += e * j
			j = 0
			e = 0
			break
			print(e * j)
		else:
			cost += e * a
			j -= a
			e = 0
	elif j <= m:
		cost += f * j
		j = 0
		f = 0
		break
	else:
		cost += f * m
		j -= m
		f = 0
print(cost)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
sone = int(input())
stwo = int(input())
if sone >= stwo:
	fone = min(jackets, ties)
	jackets -= fone
	ftwo = min(jackets, scarves, vests)
else:
	ftwo = min(jackets, scarves, vests)
	jackets -= ftwo
	fone = min(jackets, ties)
print(fone * sone + ftwo * stwo)


INT = lambda : int(input())
a = INT()
b = INT()
c = INT()
d = INT()
e = INT()
f = INT()
if e > f:
	m = min(a, d) * e
	d -= min(a, d)
	m += min(b, c, d) * f
elif e < f:
	m = min(b, c, d) * f
	d -= min(b, c, d)
	m += min(a, d) * e
elif min(a, b) < min(b, c, d):
	m = min(b, c, d) * f
	d -= min(b, c, d)
	m += min(a, d) * e
else:
	m = min(a, d) * e
	d -= min(a, d)
	m += min(b, c, d) * f
print(m)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	mn = min(a, d)
	if mn == a:
		d -= mn
	else:
		d = 0
	e *= mn
	mn = min(b, c, d)
	f *= mn
	print(e + f)
else:
	mn = min(b, c, d)
	if mn == b or mn == c:
		d -= mn
	else:
		d = 0
	f *= mn
	mn = min(a, d)
	e *= mn
	print(e + f)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
t = 0
if f > e:
	k = min(b, c, d)
	if k == d:
		t += f * d
	else:
		t += f * k + e * min(a, d - k)
else:
	k = min(a, d)
	if k == d:
		t += e * d
	else:
		t += e * k + f * min(b, c, d - k)
print(t)


from sys import stdin, stdout
input = stdin.readline
tot = 0
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	x = min(a, d)
	d -= x
	tot += x * e
	y = min([b, c, d])
	tot += y * f
else:
	x = min([b, c, d])
	d -= x
	tot += x * f
	y = min(a, d)
	tot += y * e
print(tot)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
a1 = min(t, j)
b1 = min(s, v, j - a1)
b2 = min(s, v, j)
a2 = min(t, j - b2)
if e <= f:
	if b1 >= b2:
		print(b1 * f + a1 * e)
	else:
		print(b2 * f + a2 * e)
elif b1 >= b2:
	print(b2 * f + a2 * e)
else:
	print(b1 * f + a1 * e)


aa = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())
f = float(input())
ans = 0
if e >= f:
	m = min(aa, d)
	ans += m * e
	d -= m
	mm = min(b, c, d)
	ans += mm * f
else:
	m = min(b, c, d)
	ans += m * f
	d -= m
	mm = min(aa, d)
	ans += mm * e
print(int(ans))


def run(a, b, c, d, e, f):
	total = 0
	minad = min(a, d)
	minbcd = min(b, c, d)
	if e >= f:
		total += minad * e
		a -= minad
		d -= minad
	else:
		total += minbcd * f
		b -= minbcd
		c -= minbcd
		d -= minbcd
	minad = min(a, d)
	minbcd = min(b, c, d)
	total += minad * e
	a -= minad
	d -= minad
	total += minbcd * f
	b -= minbcd
	c -= minbcd
	d -= minbcd
	return total
(a, b, c, d, e, f) = [int(input()) for _ in range(6)]
print(run(a, b, c, d, e, f))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ne = min(a, d)
nf = min(b, c, d)
pos = []
pos.append(ne * e + min(b, c, d - ne) * f)
pos.append(nf * f + min(a, d - nf) * e)
print(max(pos))


(t, s, v, j) = [int(input()) for _ in range(4)]
suit1 = int(input())
suit2 = int(input())
ans = 0
if suit1 > suit2:
	nb_suit1 = min(t, j)
	ans += suit1 * nb_suit1
	t -= nb_suit1
	j -= nb_suit1
	nb_suit2 = min(s, v, j)
	ans += nb_suit2 * suit2
else:
	nb_suit2 = min(s, v, j)
	ans += nb_suit2 * suit2
	j -= nb_suit2
	nb_suit1 = min(t, j)
	ans += nb_suit1 * suit1
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s = max(e, f)
t = min(b, c, d)
if e > f:
	if a >= d:
		ans = e * d
	else:
		ans = e * a + f * min(d - a, min(b, c, d - a))
elif e == f:
	if a >= d:
		ans = e * d
	else:
		ans = e * a + e * min(b, c, d - a)
elif min(b, c) <= d:
	ans = f * min(b, c) + e * min(d - min(b, c), a)
else:
	ans = f * d
print(ans)


a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
d = int(input().strip())
e = int(input().strip())
f = int(input().strip())
q = e * min(d, a) + f * min(b, c, d - a)
w = e * min(d, a)
r = f * min(b, c, d) + e * min(d - min(b, c), a)
t = f * min(b, c, d)
print(max(q, w, r, t))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
suit1 = int(input())
suit2 = int(input())
comb1 = min(a, d)
comb2 = min(b, c, d)
a1 = suit1 * comb1 + min(b, c, d - comb1) * suit2
a2 = suit2 * comb2 + min(a, d - comb2) * suit1
print(max(a1, a2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s = 0
while d > 0 and (a > 0 or (b > 0 and c > 0)):
	if min(a, d) * e > min(b, c, d) * f:
		a -= 1
		d -= 1
		s += e
	else:
		b -= 1
		c -= 1
		d -= 1
		s += f
print(s)


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
from sys import stdin, stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def lessThanX(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def BinarySearch(a, x):
	i = bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1

def main():
	a = ip()
	b = ip()
	c = ip()
	d = ip()
	e = ip()
	f = ip()
	ans = 0
	if f > e:
		x = min([b, c, d])
		ans += f * x
		d -= x
		if d > 0:
			ans += min(a, d) * e
	elif f == e:
		p = min(b, c)
		x = min(max(a, p), d)
		ans += x * f
		d -= x
		if d > 0:
			ans += min(min(a, p), d) * f
	else:
		x = min(a, d)
		ans += x * e
		d -= x
		if d > 0:
			ans += min([b, c, d]) * f
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
ip = lambda : int(sys.stdin.readline().rstrip('\r\n'))
ai = lambda : list(map(int, sys.stdin.readline().split()))
ei = lambda : map(int, sys.stdin.readline().split())
main()


(a, b, c, d, e, f) = (int(input()), int(input()), int(input()), int(input()), int(input()), int(input()))
a1 = min(a, d)
a2 = min(b, c, d)
b1 = min(b, c, d - a1)
b2 = min(a, d - a2)
c1 = a1 * e + b1 * f
c2 = a2 * f + b2 * e
print(max(c1, c2))


import sys
import os
from io import BytesIO, IOBase

def cel(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return defaultdict(int)

def ddl():
	return defaultdict(list)

def ddd():
	return defaultdict(defaultdict(int))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
for _ in range(1):
	a = ii()
	b = ii()
	c = ii()
	d = ii()
	e = ii()
	f = ii()
	res = max(e * min(a, d) + f * min(b, c, d - min(a, d)), f * min(b, c, d) + e * min(a, d - min(b, c, d)))
	print(res)


(ties, scarves, vests, jackets, suit_1_cost, suti_2_cost) = [int(input()) for _ in range(6)]
result = 0
if suti_2_cost > suit_1_cost:
	n = min(scarves, vests, jackets)
	m = min(jackets - n, ties)
else:
	m = min(ties, jackets)
	n = min(jackets - m, scarves, vests)
print(m * suit_1_cost + n * suti_2_cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
usum = 0
if e > f:
	usum = 0
	tmp = min(a, d)
	a -= tmp
	d -= tmp
	usum += tmp * e
	tmp = min(b, c, d)
	usum += tmp * f
else:
	usum = 0
	tmp = min(b, c, d)
	b -= tmp
	c -= tmp
	d -= tmp
	usum += tmp * f
	tmp = min(a, d)
	usum += tmp * e
print(usum)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
while True:
	min_1 = min(a, d)
	d1 = d - min_1
	min_2 = min(b, c, d1)
	sum1 = min_1 * e + min_2 * f
	break
while True:
	min_1 = min(b, c, d)
	d2 = d - min_1
	min_2 = min(a, d2)
	sum2 = min_1 * f + min_2 * e
	break
if sum1 > sum2:
	print(sum1)
else:
	print(sum2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f < e:
	type1 = [a, d]
	type1.sort()
	type1 = type1[0]
	type2 = [b, c, d - type1]
	type2.sort()
	type2 = 0 if type2[0] < 1 else type2[0]
	print(type1 * e + type2 * f)
else:
	type2 = [b, c, d]
	type2.sort()
	type2 = type2[0]
	type1 = [a, d - type2]
	type1.sort()
	type1 = 0 if type1[0] < 1 else type1[0]
	print(type1 * e + type2 * f)


(a, b, c, d, e, f) = [int(input()) for i in range(6)]
k = min(b, c)
cost = 0
if e >= f:
	cost = min(a, d) * e + min(max(d - min(a, d), 0), k) * f
else:
	cost = min(k, d) * f + min(max(d - min(k, d), 0), a) * e
print(cost)


tie = int(input())
scarf = int(input())
vest = int(input())
jack = int(input())
suit1 = int(input())
suit2 = int(input())
maxc = 0
if suit1 >= suit2:
	y = min(tie, jack)
	jack -= y
	maxc += y * suit1
	if jack > 0:
		x = min(scarf, vest, jack)
		jack -= x
		maxc += x * suit2
else:
	x = min(scarf, vest, jack)
	jack -= x
	maxc += x * suit2
	if jack > 0:
		y = min(tie, jack)
		jack -= y
		maxc += y * suit1
print(maxc)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
if f > e:
	a = min(s, v, j)
	x = j - a
	x = a * f + min(x, t) * e
	print(x)
elif f < e:
	a = min(t, j)
	x = j - a
	x = a * e + min(x, s, v) * f
	print(x)
else:
	if t > min(s, v):
		x = j - min(t, j)
		x = (min(t, j) + min(x, v, s)) * f
	else:
		x = j - min(s, v, j)
		x = (min(s, v, j) + min(x, t)) * e
	print(x)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f > e:
	min1 = min(b, c, d)
	cost1 = min1 * f
	d = d - min1
	min2 = min(a, d)
	cost2 = min2 * e
	print(cost1 + cost2)
else:
	min1 = min(a, d)
	cost1 = min1 * e
	d = d - min1
	min2 = min(b, c, d)
	cost2 = min2 * f
	print(cost1 + cost2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f > e:
	tot = min(b, c, d)
	price = tot * f
	tot = min(a, d - tot)
	price += tot * e
else:
	tot = min(a, d)
	price = tot * e
	tot = min(b, c, d - tot)
	price += tot * f
print(price)


ties = int(input())
scarf = int(input())
vest = int(input())
jack = int(input())
first = int(input())
sec = int(input())
print(max(min(jack, ties) * first + min(jack - min(jack, ties), vest, scarf) * sec, min(jack, scarf, vest) * sec + min(jack - min(jack, scarf, vest), ties) * first))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
a1 = a
d1 = d
count = 0
tie = min(a, d)
count = count + tie * e
d = d - tie
vest = min(b, c, d)
count = count + f * vest
money = 0
v = min(b, c, d1)
money = money + v * f
d1 = d1 - v
t = min(a, d1)
money = money + t * e
print(max(money, count))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f >= e:
	m = min(b, c, d)
	s = m * f
	g = d - m
	m1 = min(g, a)
	s1 = e * m1
	print(s1 + s)
else:
	m = min(a, d)
	s = m * e
	g = d - m
	m1 = min(g, b, c)
	s1 = f * m1
	print(s + s1)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
ans = 0
if e >= f:
	x = min(t, j)
	ans += x * e
	j -= x
	t -= x
	x = min(s, v, j)
	ans += x * f
else:
	x = min(s, v, j)
	ans += x * f
	j -= x
	x = min(t, j)
	ans += x * e
print(ans)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
max1 = min(t, j)
max1 = [max1, max(0, min(j - max1, s, v))]
max2 = min(s, v, j)
max2 = [max(0, min(j - max2, t)), max2]
print(max(e * max1[0] + f * max1[1], e * max2[0] + f * max2[1]))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s = min(a, d)
t = min(b, c, d)
if e > f:
	res1 = s * e
	d = d - s
	x = min(b, c, d)
	res2 = x * f
else:
	res1 = t * f
	d = d - t
	x = min(a, d)
	res2 = x * e
print(res1 + res2)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
e = int(input())
f = int(input())
if e >= f:
	k = min(ties, jackets)
	jackets = jackets - k
	res = k * e + min(scarves, vests, jackets) * f
else:
	k = min(scarves, vests, jackets)
	jackets = jackets - k
	res = k * f + min(ties, jackets) * e
print(res)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x = d
case1 = min(a, x) * e
x = x - min(a, x)
if x > 0:
	case1 = case1 + min(c, b, x) * f
case2 = min(b, c, d) * f
d = d - min(b, c, d)
if d > 0:
	case2 = case2 + min(a, d) * e
print(max(case1, case2))


import sys
input = sys.stdin.readline
t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
ans = 0
if e > f:
	ans += min(t, j) * e
	j -= min(t, j)
	ans += min({j, s, v}) * f
else:
	ans += min({j, s, v}) * f
	j -= min({j, s, v})
	ans += min({t, j}) * e
print(ans)


m = int(input())
n = int(input())
o = int(input())
p = int(input())
q = int(input())
r = int(input())
temp1 = n
temp2 = o
temp3 = p
k = min(temp1, temp2, temp3)
temp3 -= k
r1 = k * r + min(m, temp3) * q
k = min(m, p)
p -= k
r2 = k * q + min(n, o, p) * r
if r1 > r2:
	print(r1)
else:
	print(r2)


(a, b, c, d, e, f) = [int(input()) for i in range(6)]
ans = 0
if e > f:
	ans += e * min(a, d)
	d -= min(a, d)
	ans += f * min(b, c, d)
else:
	ans += f * min(b, c, d)
	d -= min(b, c, d)
	ans += e * min(a, d)
print(ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
spent = 0
if e <= f:
	spent += min(b, c, d) * f
	(b, c, d) = (b - min(b, c, d), c - min(b, c, d), d - min(b, c, d))
	spent += min(a, d) * e
	print(spent)
else:
	spent += min(a, d) * e
	(a, d) = (a - min(a, d), d - min(a, d))
	spent += min(b, c, d) * f
	print(spent)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x = min(a, d)
awd = a - x
dwd = d - x
y = min(dwd, b, c)
z = min(d, b, c)
d2 = d - z
g = min(d2, a)
first = x * e + y * f
second = z * f + g * e
print(max(first, second))


def A():
	tie = int(input())
	scarf = int(input())
	vest = int(input())
	jacket = int(input())
	tj = int(input())
	svj = int(input())
	if scarf > vest:
		scarf = vest
	if jacket >= scarf + tie:
		print(scarf * svj + tj * tie)
	elif tj > svj:
		tjsz = min(jacket, tie)
		print(tjsz * tj + min(jacket - tjsz, scarf) * svj)
	else:
		svsz = min(scarf, jacket)
		print(svsz * svj + min(jacket - svsz, tie) * tj)
A()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
t = min(a, d)
r = min(b, c, d)
x = t * e + min(r, d - t) * f
y = r * f + min(t, d - r) * e
print(max(x, y))


t = int(input())
s = int(input())
v = int(input())
j = int(input())
c1 = int(input())
c2 = int(input())
if c2 > c1:
	p = min(s, v, j)
	j -= p
	print(p * c2 + min(t, j) * c1)
else:
	p = min(t, j)
	j -= p
	print(p * c1 + min(s, v, j) * c2)


tc = []
for i in range(6):
	tc.append(int(input()))
(a, b, c, d, e, f) = tc
if f > e:
	nums2 = min(b, c, d)
	nums1 = min(a, d - nums2)
	sum1 = nums1 * e + nums2 * f
else:
	nums1 = min(a, d)
	nums2 = min(b, c, d - nums1)
	sum1 = nums1 * e + nums2 * f
print(sum1)


l = list()
for i in range(6):
	l.append(int(input()))
(a, b, c, d, e, f) = l
c1 = 0
c2 = 0
if e > f:
	y = min(b, c)
	x = min(a, d)
	c1 = x * e
	t = d - x
	if t > 0:
		t2 = min(t, y)
		c2 = t2 * f
else:
	y = min(b, c, d)
	c1 = f * y
	t = d - y
	if t > 0:
		t2 = min(t, a)
		c2 = e * t2
print(c1 + c2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f > e:
	b_suit = min(b, c, d)
	print(b_suit * f + min(a, d - b_suit) * e)
else:
	a_suit = min(a, d)
	print(a_suit * e + min(b, c, d - a_suit) * f)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	tmp = min(a, d)
	a -= tmp
	d -= tmp
	sum = e * tmp
	sum += min(b, c, d) * f
	print(sum)
else:
	tmp = min(b, c, d)
	b -= tmp
	c -= tmp
	d -= tmp
	sum = f * tmp
	sum += min(a, d) * e
	print(sum)


tie = int(input())
sca = int(input())
ves = int(input())
jac = int(input())
e = int(input())
f = int(input())
if f > e:
	mi = min(sca, ves, jac)
	ans = mi * f
	ans += e * min(tie, jac - mi)
	print(ans)
else:
	mi = min(tie, jac)
	ans = mi * e
	ans += f * min(sca, ves, jac - mi)
	print(ans)


g = [int(input()) for i in range(0, 6)]
a = g[0]
b = g[1]
c = g[2]
d = g[3]
e = g[4]
f = g[5]
if e >= f:
	s = min(a, d)
	d = d - s
	s = s * e
	h = min(b, c, d)
	s = s + h * f
	print(s)
else:
	s = min(b, c, d)
	d = d - s
	s = s * f
	h = min(a, d)
	s = s + h * e
	print(s)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
arr3 = [e, f]
i = max(arr3)
sumd = 0
if i == e:
	arr2 = [a, d]
	u = min(arr2)
	arr = [b, c, d - u]
	k = min(arr)
	sumd = u * e + k * f
elif i == f:
	arr = [b, c, d]
	k = min(arr)
	arr = [a, d - k]
	u = min(arr)
	sumd = u * e + k * f
print(sumd)


def compute(a, b, c, d, e, f):
	if f > e:
		type_1 = min(b, c, d)
		type_e = type_1 * f
		if d > type_1:
			type_2 = min(a, d - type_1)
			return type_e + type_2 * e
		return type_e
	type_1 = min(a, d)
	type_e = type_1 * e
	if d > type_1:
		type_2 = min(b, c, d - type_1)
		return type_e + type_2 * f
	return type_e
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
print(compute(a, b, c, d, e, f))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	(x1, x2) = (e, f)
	c1 = min(d, a)
	d -= c1
	c2 = min(d, b, c)
else:
	(x1, x2) = (f, e)
	c1 = min(d, b, c)
	d -= c1
	c2 = min(d, a)
print(x1 * c1 + x2 * c2)


(t, s, v, j, x, y) = [int(input()) for i in range(6)]
print(min(t, j) * x + min(s, v, j - min(t, j)) * y if x > y else min(s, v, j) * y + min(t, j - min(s, v, j)) * x)


from sys import stdin, stdout
inp = stdin.readline
out = stdout.write
ties = int(inp())
scarves = int(inp())
vests = int(inp())
jackets = int(inp())
first_suit_cost = int(inp())
second_suit_cost = int(inp())
suit2 = min(scarves, vests, jackets)
suit2ans = suit2 * second_suit_cost
suit1ans = min(ties, jackets - suit2) * first_suit_cost
suit1alt = min(ties, jackets)
suit1ansalt = suit1alt * first_suit_cost
suit2ansalt = min(scarves, vests, jackets - suit1alt) * second_suit_cost
print(max(suit1ansalt + suit2ansalt, suit1ans + suit2ans))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
total_s1 = 0
total_s2 = 0
if f > e:
	min_s2 = min(b, c, d)
	total_s2 = f * min_s2
	min_s1 = min(a, d - min_s2)
	total_s1 = e * min_s1
else:
	min_s1 = min(a, d)
	total_s1 = e * min_s1
	min_s2 = min(b, c, d - min_s1)
	total_s2 = f * min_s2
print(total_s1 + total_s2)


r = lambda : int(input())
a = r()
b = r()
c = r()
d = r()
e = r()
f = r()
if e >= f:
	print(e * min(a, d) + min(b, c, d - min(a, d)) * f)
elif f > e:
	print(min(b, c, d) * f + min(a, d - min(b, c, d)) * e)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
first = int(input())
second = int(input())
a = t
b = min(s, v)
if j >= a + b:
	print(first * a + second * b)
else:
	ans = 0
	if first >= second:
		ans += first * min(j, a)
		j -= min(j, a)
		if j > 0:
			ans += second * min(j, b)
	else:
		ans += second * min(j, b)
		j -= min(j, b)
		if j > 0:
			ans += first * min(j, a)
	print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s = [a, b, c, d]
p = 0
if e > f:
	u = min(a, d)
	p += u * e
	s[0] -= u
	s[-1] -= u
	p += min(s[1:]) * f
	print(p)
else:
	u = min(s[1:])
	p += u * f
	s[-1] -= u
	p += min(s[0], s[-1]) * e
	print(p)


import sys
[a, b, c, d, e, f] = map(int, sys.stdin.read().split())

def Type1():
	global a, d
	r = min(a, d)
	a -= r
	d -= r
	return e * r

def Type2():
	global b, c, d
	r = min(b, c, d)
	b -= r
	c -= r
	d -= r
	return f * r
if e >= f:
	ans = Type1()
	ans += Type2()
else:
	ans = Type2()
	ans += Type1()
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ta = a
td = d
k = min(ta, td)
ta -= k
td -= k
res1 = k * e + min(b, c, td) * f
k = min(b, c, d)
d -= k
res2 = k * f + min(a, d) * e
if res1 > res2:
	print(res1)
else:
	print(res2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e >= f:
	l = min(a, d)
	a = a - l
	d = d - l
	p = e * l
	l = min(b, c, d)
	p = p + l * f
else:
	l = min(b, c, d)
	d = d - l
	p = l * f
	l = min(a, d)
	p = p + l * e
print(p)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
cost = 0
if e > f:
	abcd = min(a, d)
	if a < d:
		d = d - a
		a = 0
	else:
		a = a - d
		d = 0
	bcde = min(b, c)
	ef = min(c, d)
	fin = min(bcde, ef)
	cost = cost + f * fin + e * abcd
else:
	bcde = min(b, c)
	ef = min(c, d)
	fin = min(bcde, ef)
	if fin == b:
		c = c - b
		d = d - b
		b = 0
	elif fin == c:
		b = b - c
		d = d - c
		c = 0
	else:
		c = c - d
		d = 0
		b = b - d
	cost = cost + f * fin
	abcd = min(a, d)
	cost = cost + abcd * e
print(cost)


import os
import sys
from io import BytesIO, IOBase
from collections import deque
from string import ascii_lowercase

def solution(a, b, c, d, e, f):
	(aa, bb, cc, dd) = (a, b, c, d)
	min_1 = min(aa, dd)
	min_2 = min([bb, cc, dd])
	bb -= min_2
	cc -= min_2
	dd -= min_2
	if dd:
		min_1 = min(aa, dd)
		res1 = min_1 * e + min_2 * f
	else:
		res1 = min_2 * f
	(aa, bb, cc, dd) = (a, b, c, d)
	min_1 = min(aa, dd)
	min_2 = min([bb, cc, dd])
	aa -= min_1
	dd -= min_1
	if dd:
		min_2 = min([bb, cc, dd])
		res2 = min_1 * e + min_2 * f
	else:
		res2 = min_1 * e
	write(max(res1, res2))

def main():
	(a, b, c) = (r_int(), r_int(), r_int())
	(d, e, f) = (r_int(), r_int(), r_int())
	solution(a, b, c, d, e, f)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())

def p_array(arr):
	for x in arr:
		write(x, end=' ')
	write()
main()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
money = 0
if e > f:
	num = min(a, d)
	a = a - num
	d = d - num
	money = money + e * num
	num = min(b, c, d)
	money = money + f * num
else:
	num = min(b, c, d)
	c = c - num
	d = d - num
	b = b - num
	money = money + f * num
	num = min(a, d)
	money = money + e * num
print(money)


import sys
import collections
import heapq
import math
import bisect
input = sys.stdin.readline

def rints():
	return map(int, input().strip().split())

def rstr():
	return input().strip()

def rint():
	return int(input().strip())

def rintas():
	return [int(i) for i in input().strip().split()]

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
a = rint()
b = rint()
c = rint()
d = rint()
e = rint()
f = rint()
ans = 0
r = min(a, d)
c2 = r * e + f * min(b, c, d - r)
r = min(b, c, d)
c1 = r * f + e * min(a, d - r)
print(max(c1, c2))


def num():
	return int(input())

def line():
	return map(int, input().split())
(a, b, c, d, e, f) = (num(), num(), num(), num(), num(), num())
ans = 0
if e > f:
	q = min(a, d)
	d -= q
	ans += e * q
	q = min(b, c, d)
	ans += f * q
else:
	q = min(b, c, d)
	d -= q
	ans += f * q
	q = min(a, d)
	ans += e * q
print(ans)


def io():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	return [a, b, c, d, e, f]

def main():
	(a, b, c, d, e, f) = io()
	type_a = min(a, d)
	type_b = min(b, c, d)
	cost = 0
	if e > f:
		cost += type_a * e
		d -= type_a
		type_b = min(b, c, d)
		tmp_cost = type_b * f
		if tmp_cost > 0:
			cost += tmp_cost
	else:
		cost += type_b * f
		d -= type_b
		type_a = min(a, d)
		tmp_cost = type_a * e
		if tmp_cost > 0:
			cost += tmp_cost
	print(cost)
main()


n = []
for i in range(0, 6):
	n.append(int(input()))
(a, b, c, d, price1, price2) = [int(x) for x in n]
if price1 >= price2:
	suit1 = min(a, d)
	d -= suit1
	suit2 = min(b, c, d)
	totalPrice = suit1 * price1 + suit2 * price2
else:
	suit2 = min(b, c, d)
	d -= suit2
	suit1 = min(a, d)
	totalPrice = suit1 * price1 + suit2 * price2
print(totalPrice)


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = stdin.readline()
	x.lower()
	x = list(x)
	x.pop()
	return x

def si():
	return stdin.readline()
a = ii()
b = ii()
c = ii()
d = ii()
e = ii()
f = ii()
s = 0
if e < f:
	x = min(b, c, d)
	s += x * f
	d -= x
	x = min(a, d)
	s += x * e
else:
	x = min(a, d)
	s += x * e
	d -= x
	x = min(b, c, d)
	s += x * f
print(s)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
c_1 = int(input())
c_2 = int(input())
net = 0
if c_1 >= c_2:
	if t >= j:
		print(j * c_1)
	else:
		net += t * c_1
		j -= t
		net += min(s, v, j) * c_2
		print(net)
else:
	a = min(s, v, j)
	net += a * c_2
	j -= a
	net += min(j, t) * c_1
	print(net)


def solution(a, b, c, d, e, f):
	g = 0
	h = 0
	i = 0
	if e > f:
		g = min(d, a)
		h = min(int(d - g), b, c)
		i = int(h * f + g * e)
	else:
		h = min(d, b, c)
		g = min(int(d - h), a)
		i = int(h * f + g * e)
	print(i)
solution(int(input()), int(input()), int(input()), int(input()), int(input()), int(input()))


a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
d = int(input().strip())
e = int(input().strip())
f = int(input().strip())
(x, y) = (0, 0)
if f > e:
	m = min(b, c, d)
	(x, y) = (m * f, min(d - m, a) * e)
else:
	m = min(a, d)
	(x, y) = (m * e, min(d - m, b, c) * f)
print(x + y)


(a, b, c, d, e, f) = [int(input()) for i in range(6)]
x = min(b, c, d)
x1 = min(d, a)
if d > x:
	y = d - x
else:
	y = 0
if d > a:
	z = d - a
else:
	z = 0
if e > f:
	print(x1 * e + min(z, b, c) * f)
else:
	print(x * f + min(y, a) * e)


import time
LOCAL = False
start_time = None
if LOCAL:
	start_time = time.time()
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	mina = min(a, d)
	d -= mina
	cnt = mina * e + min(d, b, c) * f
else:
	minb = min(b, c, d)
	d -= minb
	cnt = minb * f + min(a, d) * e
print(cnt)
if LOCAL:
	print('--- %s seconds ---' % (time.time() - start_time))


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	c_set_1 = 0
	c_set_2 = 0
	if e > f:
		c_set_1 = min([a, d])
		d -= c_set_1
		c_set_2 = min([b, c, d])
	else:
		c_set_2 = min([b, c, d])
		d -= c_set_2
		c_set_1 = min([a, d])
	print(c_set_1 * e + c_set_2 * f)
main()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	(p1, p2) = (e, f)
	c1 = min(d, a)
	d -= c1
	c2 = min(d, b, c)
else:
	(p1, p2) = (f, e)
	c1 = min(d, b, c)
	d -= c1
	c2 = min(d, a)
print(p1 * c1 + p2 * c2)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
e = int(input())
f = int(input())
tmp = 0
total = 0

def get_total_e(jackets, ties):
	if ties > jackets:
		total = jackets * e
		jackets = 0
	else:
		total = ties * e
		jackets = jackets - ties
	return (total, jackets)

def get_total_f(jackets, scarves, vests):
	if scarves > vests:
		tmp = vests
	else:
		tmp = scarves
	if jackets > tmp:
		jackets = jackets - tmp
		total = tmp * f
	else:
		total = jackets * f
		jackets = 0
	return (total, jackets)
if e > f:
	(total_e, jackets) = get_total_e(jackets, ties)
	if jackets > 0:
		(total_f, jackets) = get_total_f(jackets, scarves, vests)
		total = total_e + total_f
	else:
		total = total_e
else:
	(total_f, jackets) = get_total_f(jackets, scarves, vests)
	if jackets > 0:
		(total_e, jackets) = get_total_e(jackets, ties)
		total = total_f + total_e
	else:
		total = total_f
print(total)


import sys

def rint():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().rstrip('\n')

def oint():
	return int(input())
a = oint()
b = oint()
c = oint()
d = oint()
e = oint()
f = oint()
cost = 0
if e > f:
	en = min(a, d)
	a -= en
	d -= en
	cost += en * e
	cost += f * min([b, c, d])
else:
	fn = min([b, c, d])
	b -= fn
	c -= fn
	d -= fn
	cost += fn * f
	cost += e * min(a, d)
print(cost)


import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
c = int(sys.stdin.readline())
d = int(sys.stdin.readline())
e = int(sys.stdin.readline())
f = int(sys.stdin.readline())
l2 = [b, c, d]
l1 = [a, d]
sui2 = min(l2)
f2 = f * sui2
x = l2[2] - sui2
sui1 = min(a, x)
f1 = e * sui1
f3 = f1 + f2
sui11 = min(a, d)
f11 = e * sui11
x1 = d - sui11
l2[2] = x1
sui22 = min(l2)
f22 = min(l2) * f
f33 = f11 + f22
print(max(f33, f3))


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
first = int(input())
second = int(input())
price = 0
if second > first:
	second_set = [scarves, vests, jackets]
	temp = min(second_set)
	scarves -= temp
	vests -= temp
	jackets -= temp
	price += temp * second
	first_set = [ties, jackets]
	temp = min(first_set)
	ties -= temp
	jackets -= temp
	price += temp * first
else:
	first_set = [ties, jackets]
	temp = min(first_set)
	ties -= temp
	jackets -= temp
	price += temp * first
	second_set = [scarves, vests, jackets]
	temp = min(second_set)
	scarves -= temp
	vests -= temp
	jackets -= temp
	price += temp * second
print(price)


import sys
import collections
from collections import Counter
import itertools
import math
import timeit

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
d = []
for _ in range(6):
	d.append(ii())
(a, b, c, d, e, f) = tuple(d)
(x, y) = (min(a, d), min(b, c, d))
print(max(e * x + f * min(b, c, d - x), f * y + e * min(a, d - y)))


(a, b, c, d, e, f) = [int(input()) for _ in [0] * 6]
(x, y) = (min(a, d), min(b, c, d))
print(max(x * e + min(b, c, d - x) * f, y * f + min(a, d - y) * e))


(a, b, c, d, e, f) = [int(input()) for _ in range(6)]
if e > f:
	suit1 = min(a, d)
	suit2 = min(d - suit1, b, c)
else:
	suit2 = min(b, c, d)
	suit1 = min(a, d - suit2)
print(suit1 * e + suit2 * f)


for _ in range(1):
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	tt1 = 0
	tt2 = 0
	sm = min(a, d)
	tt1 += sm * e
	tt1 += min(b, c, d - sm) * f
	sm = min(b, c, d)
	tt2 += sm * f
	tt2 += min(a, d - sm) * e
	print(max(tt1, tt2))


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	a = I()
	b = I()
	c = I()
	d = I()
	e = I()
	f = I()
	ans = 0
	if e > f:
		x = min(a, d)
		ans += e * x
		a -= x
		d -= x
		y = min(b, c, d)
		ans += f * y
	else:
		x = min(b, c, d)
		ans += f * x
		b -= x
		c -= x
		d -= x
		y = min(a, d)
		ans += e * y
	return ans
print(main())


import time
a = int(input())
b = int(input())
c = int(input())
d = int(input())
set1 = int(input())
set2 = int(input())
sum = 0
for i in range(d):
	s1 = 0
	if a > 0:
		s1 = set1
	s2 = 0
	if b > 0 and c > 0:
		s2 = set2
	if s1 > s2:
		sum += s1
		a -= 1
	else:
		sum += s2
		b -= 1
		c -= 1
print(sum)


a = int(input())
b = int(input())
b = min(b, int(input()))
c = int(input())
d = int(input())
e = int(input())
res = max((d * i + e * min(c - i, b) for i in range(min(c, a) + 1)))
print(res)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
a = int(input())
b = int(input())
if a <= b:
	print(b * min(s, v, j) + a * min(t, j - min(s, v, j)))
else:
	print(a * min(t, j) + b * min(s, v, j - min(t, j)))


from sys import stdin
r = stdin.readline

def main():
	ties = int(r())
	scarves = int(r())
	vests = int(r())
	jackets = int(r())
	e = int(r())
	f = int(r())
	op1 = min(ties, jackets) * e + min(scarves, vests, jackets - min(ties, jackets)) * f
	op2 = min(scarves, vests, jackets) * f + min(ties, jackets - min(scarves, vests, jackets)) * e
	print(max(op1, op2))
main()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
min1 = min(a, d)
x = min1 * e + min(b, min(c, d - min1)) * f
min2 = min(b, min(c, d))
x2 = min2 * f + min(a, d - min2) * e
print(max(x, x2))


(a, b1, b2, c, x, y) = [int(input()) for _ in range(6)]
b = min(b1, b2)
ans = 0
if x < y:
	(x, y) = (y, x)
	(a, b) = (b, a)
ans += x * min(a, c)
c -= min(a, c)
ans += y * min(b, c)
print(ans)


import os, sys, math
import collections
if os.path.exists('testing'):
	name = os.path.basename(__file__)
	if name.endswith('.py'):
		name = name[:-3]
	src = open(name + '.txt', encoding='utf8')
	input = src.readline

def solve():
	if e > f:
		t1 = min(a, d)
		t2 = min(b, c, d - t1)
	else:
		t2 = min(b, c, d)
		t1 = min(a, d - t2)
	return t1 * e + t2 * f
a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
d = int(input().strip())
e = int(input().strip())
f = int(input().strip())
res = solve()
print(res)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
if e >= f:
	cnt_e = min(a, d)
	ans += e * cnt_e
	d -= cnt_e
	cnt_f = min(b, c, d)
	ans += f * cnt_f
else:
	cnt_f = min(b, c, d)
	ans += f * cnt_f
	d -= cnt_f
	cnt_e = min(a, d)
	ans += e * cnt_e
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
t1 = a
t2 = min(b, c)
if t1 + t2 <= d:
	print(e * t1 + f * t2)
else:
	if e >= f:
		ans = min(t1, d) * e
		ans += max(0, d - t1) * f
	else:
		ans = min(t2, d) * f
		ans += max(0, d - t2) * e
	print(ans)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
result = 0
a = int(input())
b = int(input())
if a > b:
	while t > 0 and j > 0:
		result += a
		t -= 1
		j -= 1
	while s > 0 and v > 0 and (j > 0):
		result += b
		s -= 1
		v -= 1
		j -= 1
	print(result)
else:
	while s > 0 and v > 0 and (j > 0):
		result += b
		s -= 1
		v -= 1
		j -= 1
	while t > 0 and j > 0:
		result += a
		t -= 1
		j -= 1
	print(result)


import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7
INF = float('inf')
from sys import stdin
readline = stdin.readline

def readInts():
	return list(map(int, readline().split()))

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())
a = I()
b = I()
c = I()
d = I()
e = I()
f = I()
if e >= f:
	first = min(a, d)
	a -= first
	d -= first
	second = min(b, c, d)
	print(first * e + second * f)
else:
	second = min(b, c, d)
	b -= second
	c -= second
	d -= second
	first = min(a, d)
	print(first * e + second * f)


a = [0]
for _ in range(6):
	a.append(int(input()))
a1 = min(a[1], a[4])
a2 = min(a[2], min(a[3], a[4]))
sol = 0
if max(a[5], a[6]) == a[5]:
	sol += a1 * a[5]
	a[4] = a[4] - a1
	a2 = min(a[2], min(a[3], a[4]))
	sol += a2 * a[6]
elif max(a[5], a[6]) == a[6]:
	sol += a2 * a[6]
	a[4] = a[4] - a2
	a1 = min(a[1], a[4])
	sol += a1 * a[5]
print(sol)


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	(A, B, C, D, E, F) = (int(input()) for _ in [0] * 6)
	(type1, ans) = (0, 0)
	while 1:
		(ties, scarves, vests, jackets) = (A, B, C, D)
		cost1 = E * type1
		ties -= type1
		jackets -= type1
		cost2 = F * min(scarves, vests, jackets)
		ans = max(ans, cost1 + cost2)
		if not ties or not jackets:
			break
		type1 += 1
	print(ans)
main()


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
u = min(s, v)
sum = 0
if e == max(e, f):
	sum += e * min(t, j)
	j -= min(t, j)
	sum += f * min(u, j)
else:
	sum += f * min(u, j)
	j -= min(u, j)
	sum += e * min(t, j)
print(sum)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
cost = 0
if e == f:
	cost += min(b, c, d) * f
	d -= min(b, c, d)
	cost += min(a, d) * e
if f > e:
	cost += min(b, c, d) * f
	d -= min(b, c, d)
	cost += min(a, d) * e
if e > f:
	cost += min(a, d) * e
	d -= min(a, d)
	cost += min(b, c, d) * f
print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
min1 = min(b, c, d)
min2 = min(a, d)
ans = 0
if f >= e:
	ans = min1 * f + min(d - min1, a) * e
else:
	ans = min2 * e + min(d - min2, b, c) * f
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
first = min(a, d) * e + min(b, c, d - min(a, d)) * f
second = min(b, c, d) * f + min(a, d - min(b, c, d)) * e
print(max(first, second))


t = int(input())
s = int(input())
v = int(input())
j = int(input())
c1 = int(input())
c2 = int(input())
mini2 = min(s, v)
cost1 = c2 * min(mini2, j)
if j - min(mini2, j) > 0:
	left = j - mini2
	cost1 += min(t, left) * c1
cost2 = min(t, j) * c1
if j - min(t, j) > 0:
	left = j - min(t, j)
	cost2 += min(left, mini2) * c2
print(max(cost1, cost2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
res = 0
if e > f:
	kol1 = min([a, d])
	res += kol1 * e
	d -= kol1
	r = min([d, c, b])
	res += f * r
else:
	kol2 = min([d, c, b])
	res += kol2 * f
	d -= kol2
	t = min([d, a])
	res += t * e
print(res)


tie = int(input())
scarf = int(input())
vest = int(input())
jacket = int(input())
p1 = int(input())
p2 = int(input())
if p2 > p1:
	temp = min(scarf, vest, jacket)
	total = temp * p2
	scarf -= temp
	vest -= temp
	jacket -= temp
	temp = min(tie, jacket)
	total += temp * p1
else:
	temp = min(tie, jacket)
	tie -= temp
	jacket -= temp
	total = temp * p1
	temp = min(jacket, vest, scarf)
	total += temp * p2
print(total)


tie = int(input())
scar = int(input())
vest = int(input())
jacket = int(input())
suit1 = int(input())
suit2 = int(input())
if suit1 > suit2:
	k1 = min(tie, jacket)
	jacket -= k1
	k2 = min(jacket, scar, vest)
	print(k2 * suit2 + k1 * suit1)
else:
	k2 = min(jacket, scar, vest)
	jacket -= k2
	k1 = min(tie, jacket)
	print(k2 * suit2 + k1 * suit1)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
first = int(input())
second = int(input())
total = 0
if first > second:
	if jackets >= ties:
		jackets -= ties
		total = ties * first
	else:
		total = jackets * first
		jackets -= jackets
	if scarves > jackets > 0 and jackets < vests:
		total += jackets * second
	elif scarves >= vests and jackets > 0:
		total += vests * second
	elif vests > scarves and jackets > 0:
		total += scarves * second
else:
	if jackets < scarves and jackets < vests:
		total = jackets * second
		jackets -= jackets
	elif scarves > vests:
		total = vests * second
		jackets -= vests
	else:
		total = scarves * second
		jackets -= scarves
	if jackets >= ties:
		total += ties * first
	elif ties > jackets > 0:
		total += jackets * first
print(total)


num_ties = int(input())
num_scarves = int(input())
num_vests = int(input())
num_jackets = int(input())
cost_suit_1 = int(input())
cost_suit_2 = int(input())

def solve_ep_nums(num_ties, num_scarves, num_vests, num_jackets):
	num_suits_1 = min((num_ties, num_jackets))
	num_suits_2 = min((num_scarves, num_vests, num_jackets))
	return min(num_jackets, num_suits_1 + num_suits_2)
if cost_suit_1 == cost_suit_2:
	print(solve_ep_nums(num_ties, num_scarves, num_vests, num_jackets) * cost_suit_1)
elif cost_suit_1 > cost_suit_2:
	num_suit_1 = min((num_ties, num_jackets))
	num_jackets -= num_suit_1
	num_suit_2 = min((num_scarves, num_vests, num_jackets))
	print(num_suit_1 * cost_suit_1 + num_suit_2 * cost_suit_2)
else:
	num_suit_2 = min((num_scarves, num_vests, num_jackets))
	num_jackets -= num_suit_2
	num_suit_1 = min((num_ties, num_jackets))
	print(num_suit_1 * cost_suit_1 + num_suit_2 * cost_suit_2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
f1 = int(input())
f2 = int(input())
(a1, a2) = (0, 0)
if f2 > f1:
	while b > 0 and c > 0 and (d > 0):
		a1 += f2
		b -= 1
		c -= 1
		d -= 1
	while a > 0 and d > 0:
		a2 += f1
		a -= 1
		d -= 1
else:
	while a > 0 and d > 0:
		a2 += f1
		a -= 1
		d -= 1
	while b > 0 and c > 0 and (d > 0):
		a1 += f2
		b -= 1
		c -= 1
		d -= 1
print(a1 + a2)


from copy import copy

def arr_float_inp():
	return [float(s) for s in input().split()]

def arr_int_inp():
	return [int(s) for s in input().split()]

def int_inp():
	return int(input())

def float_inp():
	return float(input())

def comp(a):
	return a[0]
a = int_inp()
b = int_inp()
c = int_inp()
d = int_inp()
e = int_inp()
f = int_inp()
first = 0
second = 0
a_c = copy(a)
b_c = copy(b)
c_c = copy(c)
d_c = copy(d)
first += min(a_c, d_c) * e
d_c -= min(a_c, d_c)
first += min(b_c, c_c, d_c) * f
a_c = copy(a)
b_c = copy(b)
c_c = copy(c)
d_c = copy(d)
second += min(b_c, c_c, d_c) * f
d_c -= min(b_c, c_c, d_c)
second += min(a_c, d_c) * e
print(max(first, second))


import sys
import math
import bisect

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	ans = 0
	if e >= f:
		n = min([a, d])
		ans += e * n
		d -= n
		n = min([b, c, d])
		ans += f * n
	else:
		n = min([b, c, d])
		ans += f * n
		d -= n
		n = min(a, d)
		ans += e * n
	print(ans)
main()


import math
a = []
for i in range(6):
	x = int(input())
	a.append(x)
res = 0
for i in range(min(a[0], a[3]) + 1):
	x = a[0] - i
	y = a[3] - i
	res = max(res, a[4] * i + a[5] * min(a[1], min(a[2], y)))
print(res)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
count = 0
if e < f:
	count += f * min(b, c, d)
	count += e * min(a, abs(d - min(b, c, d)))
else:
	count += e * min(a, d)
	count += f * min(b, c, abs(d - min(a, d)))
print(count)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
(aa, bb, cc, dd) = (a, b, c, d)
cnt1 = min(aa, dd)
c1 = cnt1 * e
dd -= cnt1
cnt2 = min(bb, cc, dd)
c1 += cnt2 * f
cnt1 = min(b, c, d)
c2 = cnt1 * f
d -= cnt1
cnt2 = min(a, d)
c2 += cnt2 * e
print(max(c1, c2))


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
suit1 = int(input())
suit2 = int(input())
if suit1 > suit2:
	s1 = min(ties, jackets)
	s2 = min(jackets - s1, scarves, vests)
	print(s1 * suit1 + s2 * suit2)
else:
	s2 = min(jackets, scarves, vests)
	s1 = min(ties, jackets - s2)
	print(s1 * suit1 + s2 * suit2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
c1 = int(input())
c2 = int(input())
if c1 < c2:
	s = c2 * min(b, c, d)
	d -= min(b, c, d)
	s += c1 * min(d, a)
else:
	s = c1 * min(a, d)
	d -= min(a, d)
	s += c2 * min(d, b, c)
print(s)


def str_inp(n):
	return [float(stdin.readline()) for x in range(n)]
from sys import *
(a, b, c, d, e, f) = str_inp(6)
ans = 0
if e >= f:
	ans += min(a, d) * e
	d -= min(a, d)
	ans += min(b, c, d) * f
else:
	ans += min(b, c, d) * f
	d -= min(b, c, d)
	ans += min(a, d) * e
stdout.write(str(int(ans)))


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
a = inputnum()
b = inputnum()
c = inputnum()
d = inputnum()
e = inputnum()
f = inputnum()
ans = 0
if e > f:
	ans += e * min(a, d)
	d -= min(a, d)
	ans += f * min(b, min(c, d))
	print(ans)
else:
	ans += f * min(b, min(c, d))
	d -= min(b, min(c, d))
	ans += e * min(a, d)
	print(ans)


import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
d2 = d
min1 = min(a, d)
min2 = min(b, c, d)
cost1 = 0
cost2 = 0
cost1 = min1 * e
if min1 != d:
	d = d - min1
	cost1 += min(b, c, d) * f
cost2 = min2 * f
if min2 != d2:
	d2 = d2 - min2
	cost2 += min(a, d2) * e
if cost1 > cost2:
	print(cost1)
else:
	print(cost2)


import unittest
import sys

class Tests(unittest.TestCase):

	def test1(self):
		f1 = open('tests/1.txt')
		f2 = open('tests/1a.txt')
		sys.stdin = f1
		self.assertEqual(main(), int(f2.read()), '1st test')
		f1.close()
		f2.close()
		sys.stdin = sys.__stdin__

	def test2(self):
		f1 = open('tests/2.txt')
		f2 = open('tests/2a.txt')
		sys.stdin = f1
		self.assertEqual(main(), int(f2.read()), '2nd test')
		f1.close()
		f2.close()
		sys.stdin = sys.__stdin__

	def test3(self):
		f1 = open('tests/3.txt')
		f2 = open('tests/3a.txt')
		sys.stdin = f1
		self.assertEqual(main(), int(f2.read()), '3rd test')
		f1.close()
		f2.close()
		sys.stdin = sys.__stdin__

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	s = 0
	if e > f:
		s += e * min(a, d)
		d -= min(a, d)
		s += f * min(b, c, d)
	else:
		s += f * min(b, c, d)
		d -= min(b, c, d)
		s += e * min(a, d)
	return s
print(main())


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
suit1 = [a, d]
suit2 = [b, c, d]
if e > f:
	num1 = min(suit1)
	suit2[2] -= num1
	num2 = min(suit2)
else:
	num2 = min(suit2)
	suit1[1] -= num2
	num1 = min(suit1)
print(num1 * e + num2 * f)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
suit1 = int(input())
suit2 = int(input())
cost = 0
if suit1 > suit2:
	if ties < jackets:
		cost += ties * suit1
		jackets -= ties
	else:
		cost += jackets * suit1
		jackets = 0
	if scarves <= vests and scarves <= jackets:
		cost += scarves * suit2
		jackets -= scarves
	elif vests <= scarves and vests <= jackets:
		cost += vests * suit2
		jackets -= vests
	elif jackets <= scarves and jackets <= vests:
		cost += jackets * suit2
		jackets = 0
else:
	if scarves <= vests and scarves <= jackets:
		cost += scarves * suit2
		jackets -= scarves
	elif vests <= scarves and vests <= jackets:
		cost += vests * suit2
		jackets -= vests
	elif jackets <= scarves and jackets <= vests:
		cost += jackets * suit2
		jackets = 0
	if ties < jackets:
		cost += ties * suit1
		jackets -= ties
	else:
		cost += jackets * suit1
		jackets = 0
print(cost)


for i in range(1):
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	c1 = int(input())
	c2 = int(input())
	ans = 0
	if c1 > c2:
		mi = min(a, d)
		d = d - mi
		ans = ans + c1 * mi
		mi = min(b, c, d)
		ans = ans + c2 * mi
		print(ans)
	else:
		mi = min(b, c, d)
		d = d - mi
		ans = ans + c2 * mi
		mi = min(a, d)
		ans = ans + c1 * mi
		print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
c1 = int(input())
c2 = int(input())
p = 0
if c2 > c1:
	m = min(b, c, d)
	b -= m
	c -= m
	d -= m
	p += m * c2
	if d > 0:
		p += min(a, d) * c1
else:
	m = min(a, d)
	a -= m
	d -= m
	p += m * c1
	if d > 0:
		p += min(b, c, d) * c2
print(p)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e >= f:
	p = min(a, d)
	ans = p * e + max(0, min(b, c, d - p)) * f
else:
	p = min(b, c, d)
	ans = p * f + max(0, min(a, d - p)) * e
print(ans)


from sys import stdin, stdout
(ties, scarves, vests, jackets, price1, price2) = [int(x) for x in [input(), input(), input(), input(), input(), input()]]
max1 = min(ties, jackets)
max2 = min(scarves, vests, jackets)
if price1 > price2:
	suit1 = max1 * price1
	jacketsLeft = jackets - max1
	max2 = min(scarves, vests, jacketsLeft)
	suit2 = max2 * price2
	totSum = suit1 + suit2
else:
	suit2 = max2 * price2
	jacketsLeft = jackets - max2
	max1 = min(ties, jacketsLeft)
	suit1 = max1 * price1
	totSum = suit1 + suit2
print(totSum)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
cost = 0
if f >= e:
	type2_number = min(d, min(b, c))
	type1_number = min(d - type2_number, a)
	cost = f * type2_number + e * type1_number
else:
	type1_number = min(a, d)
	type2_number = min(d - type1_number, min(b, c))
	cost = f * type2_number + e * type1_number
print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
a1 = max(e, f)
suma = 0
if a1 == f:
	suma = min(b, c, d) * f
	(b, c, d) = (b - min(b, c, d), c - min(b, c, d), d - min(b, c, d))
	if a > 0 and d > 0:
		suma = suma + min(a, d) * e
else:
	suma = min(a, d) * e
	(a, d) = (a - min(a, d), d - min(a, d))
	if b > 0 and c > 0 and (d > 0):
		suma = suma + min(b, c, d) * f
print(suma)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
el = [a, d]
fl = [b, c, d]
me = min(el)
ffl = [b, c, d - me]
mf = min(fl)
eel = [a, d - mf]
print(max([me * e + min(ffl) * f, mf * f + min(eel) * e]))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
ans = min(a, d) * e + min(b, c, d - min(a, d)) * f
ans1 = 0
ans1 = min(b, c, d) * f + min(a, d - min(b, c, d)) * e
print(max(ans, ans1))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	k1 = min(a, d)
	k2 = min(b, c, d - k1)
	print(k1 * e + k2 * f)
else:
	k1 = min(c, b, d)
	k2 = min(a, d - k1)
	print(f * k1 + e * k2)


a = eval(input())
b = eval(input())
c = eval(input())
d = eval(input())
e = eval(input())
f = eval(input())
if e > f:
	if a > d:
		w = d * e
	else:
		A = d - a
		if A > max(b, c):
			w = a * e + min(b, c) * f
		else:
			w = a * e + min(A, b, c) * f
elif d > min(b, c):
	B = d - min(b, c)
	if B > a:
		w = a * e + f * min(b, c)
	else:
		w = B * e + f * min(b, c)
else:
	w = min(d, b, c) * f
print(w)


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict

def getlist():
	return list(map(int, input().split()))

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	A = a
	B = min(b, c)
	D = d
	E = e
	F = f
	if A + B <= D:
		ans = E * A + F * B
		print(ans)
		return
	if E >= F:
		ans = 0
		s = min(D, A)
		ans += E * s
		ans += (D - s) * F
		print(ans)
	else:
		ans = 0
		s = min(D, B)
		ans += F * s
		ans += (D - s) * E
		print(ans)
main()


import os
import sys

def main():
	print(solve(read_int(), read_int(), read_int(), read_int(), read_int(), read_int()))

def solve(A, B, C, D, E, F):
	t = 0
	if E >= F:
		x = min(A, D)
		t += x * E
		A -= x
		D -= x
	else:
		y = min(B, C, D)
		t += y * F
		B -= y
		C -= y
		D -= y
	x = min(A, D)
	t += x * E
	A -= x
	D -= x
	y = min(B, C, D)
	t += y * F
	B -= y
	C -= y
	D -= y
	return t
DEBUG = 'DEBUG' in os.environ

def inp():
	return sys.stdin.readline().rstrip()

def read_int():
	return int(inp())

def read_ints():
	return [int(e) for e in inp().split()]

def dprint(*value, sep=' ', end='\n'):
	if DEBUG:
		print(*value, sep=sep, end=end)
main()


a = int(input())
bu = int(input())
ci = int(input())
c = min(bu, ci)
d = int(input())
e = int(input())
f = int(input())
l = []
if d <= a + c:
	for i in range(d + 1):
		if i <= a and d - i <= c:
			l += [e * i + f * (d - i)]
	print(max(l))
else:
	print(e * a + f * c)


import sys
pin = sys.stdin.readline
pout = sys.stdout.write
a = int(pin())
b = int(pin())
c = int(pin())
d = int(pin())
e = int(pin())
f = int(pin())
first = 0
second = 0
third = 0
fourth = 0
fifth = 0
sixth = 0
if min(a, d) == d:
	first = d * e
	j = 0
	second = min(b, c, j) * f
if min(a, d) == a:
	third = a * e
	x = d - a
	fourth = min(b, c, x) * f + third
mine = min(b, c, d)
fifth = mine * f
d = d - mine
if d < a:
	sixth = d * e + fifth
else:
	sixth = a * e + fifth
print(max(first, second, third, fourth, fifth, sixth))


tie = int(input())
scarf = int(input())
vest = int(input())
jacket = int(input())
suit1 = int(input())
suit2 = int(input())
price1 = suit1 * min(tie, jacket) + suit2 * min(jacket - min(tie, jacket), scarf, vest)
price2 = suit1 * min(tie, jacket - min(jacket, scarf, vest)) + suit2 * min(jacket, scarf, vest)
print(max(price1, price2))


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from collections import defaultdict as dd
l = []
for i in range(6):
	l.append(I()[0])
(a, b, c, d, e, f) = l
ans = 0
for i in range(d + 1):
	j = d - i
	ans = max(ans, min(a, i) * e + min(b, c, j) * f)
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f >= e:
	m = min(b, c, d)
	suma = m * f
	b -= m
	c -= m
	d -= m
	m1 = min(a, d)
	suma += m1 * e
else:
	m = min(a, d)
	suma = m * e
	a -= m
	d -= m
	m1 = min(b, c, d)
	suma += m1 * f
print(suma)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
c1 = int(input())
c2 = int(input())
if c1 > c2:
	smax1 = min(t, j) * c1
	j1 = j - min(t, j)
	smax2 = min(s, v, j1) * c2
	print(smax1 + smax2)
else:
	smax1 = min(s, v, j) * c2
	j1 = j - min(s, v, j)
	smax2 = min(t, j1) * c1
	print(smax1 + smax2)


import os
import sys
from io import BytesIO, IOBase

def solve(a, b, c, d, e, f):
	ans = 0
	if e >= f:
		ans += e * min(d, a)
		d = d - min(d, a)
		ans += f * min(d, b, c)
	else:
		ans += f * min(d, b, c)
		d = d - min(d, b, c)
		ans += e * min(d, a)
	return ans

def main():
	a = int(input().strip())
	b = int(input().strip())
	c = int(input().strip())
	d = int(input().strip())
	e = int(input().strip())
	f = int(input().strip())
	print(solve(a, b, c, d, e, f))
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline()
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


a = eval(input())
b = eval(input())
c = eval(input())
d = eval(input())
e = eval(input())
f = eval(input())
cost = 0
if e >= f:
	if a >= d:
		cost += d * e
	else:
		cost += a * e
		cost += min(d - a, b, c) * f
elif d - min(d, b, c) > 0:
	cost += min(d, b, c) * f
	cost += min(d - min(d, b, c), a) * e
else:
	cost += f * d
print(cost)


(a, b, c, d, e, f) = [int(input()) for _ in range(6)]
ans = 0
for q in range(min(b, c, d) + 1):
	p = min(a, d - q)
	if ans < e * p + q * f:
		ans = e * p + q * f
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x = [a, b, c, d]
y = [a, b, c, d]
xx = [a, d]
yy = [b, c, d]
yy[2] -= min(xx)
xxx = [a, d]
yyy = [b, c, d]
xxx[1] -= min(yyy)
print(max(min(xx) * e + min(yy) * f, min(yyy) * f + min(xxx) * e))


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
cost1 = int(input())
cost2 = int(input())
ret = 0
if cost2 > cost1:
	min_count2 = min(scarves, min(vests, jackets))
	ret += min_count2 * cost2
	jackets -= min_count2
	min_count1 = min(jackets, ties)
	ret += min_count1 * cost1
else:
	min_count1 = min(jackets, ties)
	ret += min_count1 * cost1
	jackets -= min_count1
	min_count2 = min(scarves, min(vests, jackets))
	ret += min_count2 * cost2
print(ret)


from sys import stdin
input = stdin.readline
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
if e > f:
	while a > 0 and d > 0:
		a -= 1
		d -= 1
		ans += e
	while b > 0 and c > 0 and (d > 0):
		b -= 1
		c -= 1
		d -= 1
		ans += f
else:
	while b > 0 and c > 0 and (d > 0):
		b -= 1
		c -= 1
		d -= 1
		ans += f
	while a > 0 and d > 0:
		a -= 1
		d -= 1
		ans += e
print(ans)


def solve():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	max_suit_one = min(a, d)
	max_suit_two = min(b, c, d)
	total = 0
	while max_suit_one > 0 or max_suit_two > 0:
		if max_suit_two == 0:
			total += max_suit_one * e
			print(total)
			return
		elif max_suit_one == 0:
			total += max_suit_two * f
			print(total)
			return
		elif e > f:
			total += max_suit_one * e
			d -= max_suit_one
			max_suit_one = 0
			max_suit_two = min(b, c, d)
		else:
			total += max_suit_two * f
			d -= max_suit_two
			max_suit_two = 0
			max_suit_one = min(a, d)
	print(total)
solve()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	price_1 = min(a, d) * e
	rem_jackets = d - min(a, d)
	price_2 = min(b, c, rem_jackets) * f
	final_price = price_1 + price_2
	print(final_price)
else:
	price_1 = min(b, c, d) * f
	rem_jackets = d - min(b, c, d)
	price_2 = min(a, rem_jackets) * e
	final_price = price_1 + price_2
	print(final_price)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x = min(a, d)
y = min(b, c, d)
profit = 0
if e > f:
	profit = x * e
	d -= x
	y = min(b, c, d)
	profit += y * f
	print(profit)
elif e < f:
	profit = y * f
	d -= y
	x = min(a, d)
	profit += x * e
	print(profit)
else:
	print(min(d, x + y) * e)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
bcd = min(b, c, d)
r1 = bcd * f
ad = min(a, d - min(b, c, d))
r2 = ad * e
val1 = r1 + r2
da = min(a, d)
rr1 = da * e
dcb = min(b, c, d - min(a, d))
rr2 = dcb * f
val2 = rr1 + rr2
if val1 > val2:
	print(val1)
else:
	print(val2)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = 1
	rr = []
	for _ in range(t):
		a = I()
		b = I()
		c = I()
		d = I()
		e = I()
		f = I()
		r = 0
		if e > f:
			t = min(a, d)
			r += e * t
			d -= t
			a -= t
		u = min(b, c, d)
		r += f * u
		d -= u
		t = min(a, d)
		r += e * t
		rr.append(r)
	return JA(rr, '\n')
print(main())


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
big = max(e, f)
x = min(b, c)
if big == f:
	if d - x > 0:
		sum = min(x, d) * f + min(a, d - x) * e
	else:
		sum = d * f
elif d - a > 0:
	sum = min(a, d) * e + min(x, d - a) * f
else:
	sum = d * e
print(sum)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f > e:
	n = min(b, c, d)
	cost = n * f
	d -= n
	n = min(a, d)
	cost += n * e
else:
	n = min(a, d)
	cost = n * e
	d -= n
	n = min(b, c, d)
	cost += n * f
print(cost)


import sys
reader = (int(line.rstrip()) for line in sys.stdin)
a = next(reader)
b = next(reader)
c = next(reader)
d = next(reader)
e = next(reader)
f = next(reader)
b = min(b, c)
if e > f:
	(e, f) = (f, e)
	(a, b) = (b, a)
exp_costume = min(b, d)
d -= exp_costume
cost = e * min(a, d) + f * exp_costume
print(cost)


A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
F = int(input())
wyn = 0
if E > F:
	if A >= D:
		wyn = D * E
	else:
		wyn = A * E
		wyn += min(B, C, D - A) * F
elif E <= F:
	if min(B, C) >= D:
		wyn = D * F
	else:
		wyn = min(B, C) * F
		wyn += min(A, D - min(B, C)) * E
print(wyn)


(a, b, c, d, e, f) = (int(input()), int(input()), int(input()), int(input()), int(input()), int(input()))
s = 0
if f >= e:
	m2 = min([b, c, d])
	s = s + f * m2
	if d > m2:
		s = s + e * min([d - m2, a])
elif d <= a:
	s = s + d * e
else:
	s = s + e * a
	s = s + f * min([d - a, b, c])
print(s)


from math import *
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
t1 = 0
t2 = 0
ma = -1
for i in range(min(a, d) + 1):
	t2 = max(min(b, c, d - i), 0)
	ma = max(ma, i * e + t2 * f)
print(ma)


t = int(input())
sc = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
ans = 0
if f > e:
	x = min(sc, v, j)
	ans += x * f
	j = j - x
	y = min(t, j)
	ans += y * e
	print(ans)
else:
	x = min(t, j)
	ans += x * e
	j = j - x
	y = min(sc, v, j)
	ans += y * f
	print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
sum = 0
if e > f:
	min_1 = min(a, d)
	a = a - min_1
	d = d - min_1
	sum += min_1 * e
	min_2 = min(b, c)
	min_2 = min(min_2, d)
	sum += f * min_2
	b = b - min_2
	c = c - min_2
	d = d - min_2
	print(sum)
else:
	min_2 = min(b, c)
	min_2 = min(min_2, d)
	sum += f * min_2
	b = b - min_2
	c = c - min_2
	d = d - min_2
	min_1 = min(a, d)
	a = a - min_1
	d = d - min_1
	sum += min_1 * e
	print(sum)


import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
_m = min(a, d)
ans1 = _m * e + max(0, min(b, c, d - _m)) * f
_m = min(b, c, d)
ans2 = _m * f + max(0, min(a, d - _m)) * e
print(max(ans1, ans2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x = 0
if e >= f:
	if a >= d:
		x += d * e
	elif d > a:
		y = d - a
		x += a * e
		z = min(y, b, c)
		x += z * f
elif f > e:
	if b >= d and c >= d:
		x += d * f
	elif d > b and d > c:
		y = min(b, c)
		z = d - y
		x += y * f
		m = min(z, a)
		x += m * e
	elif d >= b and c > d or (d >= c and b > d):
		y = min(b, c)
		z = d - y
		x += y * f
		m = min(z, a)
		x += m * e
print(x)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
first = min([t, j])
second = min([s, v, j])
ans = 0
if e > f:
	j = j - first
	t = t = first
	ans += first * e
	first = min([t, j])
	second = min([s, v, j])
	j = j - second
	ans += second * f
else:
	j = j - second
	v = v - second
	ans += second * f
	first = min([t, j])
	second = min([s, v, j])
	j = j - first
	ans += first * e
print(ans)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
c1 = int(input())
c2 = int(input())
ans = 0
if c1 > c2:
	delta = min(t, j)
	ans += delta * c1
	j -= delta
	t -= delta
	delta2 = min(s, v, j)
	ans += delta2 * c2
elif c2 > c1:
	delta2 = min(s, v, j)
	ans += delta2 * c2
	j -= delta2
	s -= delta2
	v -= delta2
	delta = min(t, j)
	ans += delta * c1
else:
	ans += c1 * t
	j -= t
	delta2 = min(s, v, j)
	ans += c2 * delta2
print(ans)


from math import ceil
from math import factorial
from collections import Counter
from operator import itemgetter
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
t = ii()
s = ii()
v = ii()
j = ii()
e = ii()
f = ii()
ans = 0
if e >= f:
	ans += min(t, j) * e
	mini = min(t, j)
	t -= mini
	j -= mini
	ans += min(s, v, j) * f
else:
	ans += min(s, v, j) * f
	mini = min(s, v, j)
	s -= mini
	v -= mini
	j -= mini
	ans += min(t, j) * e
print(ans)


fir = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
sec = min(b, c)
res = 0
while d != 0:
	if (e >= f or sec == 0) and fir > 0:
		res += e
		fir = fir - 1
		d -= 1
	elif sec > 0:
		res += f
		sec = sec - 1
		d -= 1
	if sec == 0 and fir == 0:
		break
print(res)


(a, b, c, d, e, f) = map(lambda _: int(input()), range(6))
p1 = a
p2 = min(b, c)
n1 = e
n2 = f
if e < f:
	(p1, p2) = (p2, p1)
	(n1, n2) = (n2, n1)
p1 = min(p1, d)
result = n1 * p1
d -= p1
p2 = min(p2, d)
result += n2 * p2
print(result)


a = eval(input())
b = eval(input())
c = eval(input())
d = eval(input())
e = eval(input())
f = eval(input())
tot = 0
if f > e:
	while b and c and (d > 0):
		tot += f
		b -= 1
		c -= 1
		d -= 1
	while a > 0 and d > 0:
		tot += e
		a -= 1
		d -= 1
else:
	while a > 0 and d > 0:
		tot += e
		a -= 1
		d -= 1
	while b and c and (d > 0):
		tot += f
		b -= 1
		c -= 1
		d -= 1
print(tot)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
print(max(min(s, v, j) * f + min(t, j - min(s, v, j)) * e, min(t, j) * e + min(s, v, j - min(t, j)) * f))


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
sum1 = 0
if e > f:
	if min(t, j) == j:
		sum1 = sum1 + j * e
	elif t == j:
		sum1 = sum1 + j * e
	else:
		sum1 = sum1 + t * e
		j = j - t
		if min(s, v, j) == j:
			sum1 = sum1 + f * j
		else:
			sum1 = sum1 + f * min(s, v)
elif min(s, v, j) == j:
	sum1 = sum1 + j * f
elif min(s, v, j) == s:
	sum1 = sum1 + f * s
	j = j - s
	sum1 = sum1 + min(t, j) * e
elif min(s, v, j) == v:
	sum1 = sum1 + f * v
	j = j - v
	sum1 = sum1 + min(t, j) * e
print(sum1)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e < f:
	suit_1 = min(b, c, d)
	d = d - suit_1
	suit_2 = min(a, d)
	print(suit_1 * f + suit_2 * e)
elif e > f:
	suit_1 = min(a, d)
	d = d - suit_1
	suit_2 = min(b, c, d)
	print(suit_1 * e + suit_2 * f)
else:
	suit_1 = min(b, c, d)
	if suit_1 == d:
		print(d * e)
	else:
		d = d - suit_1
		print(suit_1 * e + min(a, d) * e)


l = []
for i in range(6):
	l.append(int(input()))
[a, b, c, d, e, f] = l
if f < e:
	print(min(a, d) * e + min(b, c, d - min(a, d)) * f)
else:
	print(min(b, c, d) * f + min(d - min(b, c, d), a) * e)


ties = int(input())
scarves = int(input())
vest = int(input())
jackets = int(input())
first = int(input())
second = int(input())
if second > first:
	second_suits = min([scarves, vest, jackets]) * second
	first_suits = min([ties, jackets - min([scarves, vest, jackets])]) * first
else:
	first_suits = min([ties, jackets]) * first
	second_suits = min([scarves, vest, jackets - min([ties, jackets])]) * second
print(second_suits + first_suits)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
mar = max(e, f)
pri = 0
if mar == f:
	mini = min(b, c, d)
	pri = mini * f
	d = d - mini
	if d > 0:
		mini1 = min(a, d)
		pri = pri + mini1 * e
else:
	add = min(a, d)
	pri = add * e
	d = d - add
	if d > 0:
		add1 = min(b, c, d)
		pri = pri + add1 * f
print(pri)


import sys
r_input = sys.stdin.readline
a = int(r_input())
b = int(r_input())
c = int(r_input())
d = int(r_input())
e = int(r_input())
f = int(r_input())
tmp1 = min(a, d) * e + min(b, c, d - min(a, d)) * f
tmp2 = min(b, c, d) * f + min(a, d - min(b, c, d)) * e
print(max(tmp1, tmp2))


g = int(input())
sh = int(input())
z = int(input())
pid = int(input())
e = int(input())
f = int(input())
otv = 0
if e > f:
	k = min(pid, g)
	otv += e * k
	pid -= k
	g -= k
	k = min(pid, z, sh)
	otv += f * k
else:
	k = min(pid, z, sh)
	otv += f * k
	pid -= k
	z -= k
	sh -= k
	k = min(pid, g)
	otv += e * k
print(otv)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
cost = 0
if f > e:
	t = min(b, c, d)
	cost += f * t
	b -= t
	c -= t
	d -= t
	t2 = min(a, d)
	cost += e * t2
else:
	t = min(a, d)
	cost += e * t
	a -= t
	d -= t
	t2 = min(b, c, d)
	cost += f * t2
print(cost)


import math

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	x = a
	y = min(b, c)
	if d >= x + y:
		print(x * e + y * f)
	elif e > f:
		if d > x:
			print(x * e + (d - x) * f)
		else:
			print(d * e)
	elif d > y:
		print((d - y) * e + y * f)
	else:
		print(d * f)
main()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
cost1 = int(input())
cost2 = int(input())
if cost1 > cost2:
	usedD = min(a, d)
	print(usedD * cost1 + min(d - usedD, b, c) * cost2)
else:
	usedD = min(b, c, d)
	print(usedD * cost2 + min(d - usedD, a) * cost1)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
first = min(a, d)
second = min(b, c, d)
total1 = first * e + min(b, c, max(0, d - first)) * f
total2 = min(a, max(0, d - second)) * e + second * f
print(max(total1, total2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())

def case1():
	global a
	global d
	global e
	global f
	s = 0
	if a != 0 and d != 0:
		if a >= d:
			s = s + d * e
			a = a - d
			d = d - d
		elif a < d:
			s += a * e
			d = d - a
			a = a - a
	return s

def case2():
	global f
	global c
	global d
	global b
	s = 0
	if b != 0 and c != 0 and (d != 0):
		x = min(b, c, d)
		if x == b:
			s += b * f
			c = c - b
			d = d - b
			b = b - b
		elif x == c:
			s += c * f
			b = b - c
			d = d - c
			c = c - c
		else:
			s += d * f
			b = b - d
			c = c - d
			d = d - d
	return s
s = 0
if e > f:
	s = case1()
	s += case2()
else:
	s = case2()
	s += case1()
print(s)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
c1 = int(input())
c2 = int(input())
cost = 0
if c1 > c2:
	cost += min(j, t) * c1
	j -= min(j, t)
	cost += min(s, v, j) * c2
else:
	cost += min(s, v, j) * c2
	j -= min(s, v, j)
	cost += min(j, t) * c1
print(cost)


def func(l, z, comm, e, f):
	lmin = min(l)
	zmin = min(z)
	sum = 0
	if f > e:
		sum = f * zmin + e * min(comm - zmin, l[0])
	else:
		sum = e * lmin + f * min(z[0], z[1], comm - lmin)
	return sum
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
print(func([a, d], [b, c, d], d, e, f))


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
sv = min(s, v)
if e > f:
	qt = min(t, j)
	price = qt * e
	j = j - qt
	qtsv = min(j, sv)
	price += qtsv * f
else:
	qtsv = min(j, sv)
	price = qtsv * f
	j = j - qtsv
	qtsv = min(j, t)
	price += qtsv * e
print(price)


def inpu():
	return input().split(' ')

def inti(a):
	for i in range(len(a)):
		a[i] = int(a[i])
	return a

def inp():
	a = inpu()
	a = inti(a)
	return a
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e >= f:
	cost = 0
	val = min(a, d)
	d -= val
	cost += val * e
	if d > 0:
		val = min(b, c, d)
		d -= val
		cost += val * f
else:
	cost = 0
	val = min(b, c, d)
	d -= val
	cost += val * f
	if d > 0:
		val = min(a, d)
		d -= val
		cost += val * e
print(cost)


tie = int(input())
scarf = int(input())
vest = int(input())
jacket = int(input())
type1 = int(input())
type2 = int(input())
if type2 >= type1:
	cost = min(vest, scarf, jacket) * type2 + min(tie, jacket - min(vest, scarf, jacket)) * type1
else:
	cost = min(tie, jacket) * type1 + min(vest, scarf, jacket - min(tie, jacket)) * type2
print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s = 0
for i in range(2):
	if e >= f and d != 0 and (a != 0):
		while a != 0 and d != 0:
			a -= 1
			d -= 1
			s += e
	elif e < f and b != 0 and (c != 0) and (d != 0):
		while b != 0 and d != 0 and (c != 0):
			b -= 1
			c -= 1
			d -= 1
			s += f
	elif b != 0 and c != 0 and (d != 0):
		while b != 0 and d != 0 and (c != 0):
			b -= 1
			c -= 1
			d -= 1
			s += f
	if d != 0 and a != 0:
		while a != 0 and d != 0:
			a -= 1
			d -= 1
			s += e
print(s)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
s = [0] * 6
for i in range(6):
	s[i] = mint()
(a, b, c, d, e, f) = s
r = 0
if e >= f:
	while d > 0 and a > 0:
		d -= 1
		a -= 1
		r += e
	while d > 0 and b > 0 and (c > 0):
		d -= 1
		b -= 1
		c -= 1
		r += f
else:
	while d > 0 and b > 0 and (c > 0):
		d -= 1
		b -= 1
		c -= 1
		r += f
	while d > 0 and a > 0:
		d -= 1
		a -= 1
		r += e
print(r)


ar = []
for i in range(6):
	ar.append(int(input()))
(a, b, c, d, e, f) = ar
ans = 0
for i in range(d + 1):
	ans = max(ans, min(a, i) * e + min(b, c, d - i) * f)
print(ans)


a = []
for j in range(6):
	a.append(int(input()))
if a[5] > a[4]:
	h = min(a[1:4])
	g = min(a[3] - h, a[0])
	print(h * a[5] + g * a[4])
else:
	h = min(a[0], a[3])
	print(h * a[4] + min(a[3] - h, a[2], a[1]) * a[5])


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
a1 = a
b1 = b
c1 = c
d1 = d
ans1 = min(a, d)
cost1 = ans1 * e
a1 -= ans1
d1 -= ans1
cost1 += min(b1, c1, d1) * f
ans2 = min(b, c, d)
cost2 = ans2 * f
b -= ans2
c -= ans2
d -= ans2
cost2 += min(a, d) * e
ans2 += min(a, d)
print(max(cost1, cost2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	num_of_first_type = min(a, d)
	d -= min(a, d)
	num_of_sec_type = min(b, c, d)
	ans = num_of_first_type * e + num_of_sec_type * f
else:
	num_of_sec_type = min(b, c, d)
	d -= min(b, c, d)
	num_of_first_type = min(a, d)
	ans = num_of_first_type * e + num_of_sec_type * f
print(ans)


import math
import sys
input = sys.stdin.readline
R = lambda : list(map(int, input().split()))
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s = min(a, d)
h = min(b, c, d)
cnt = h * f
d1 = d - h
g = min(a, d1) * e
cnt = cnt + g
cnt1 = s * e
d = d - s
r = min(b, c, d) * f
cnt1 = cnt1 + r
print(max(cnt, cnt1))


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(str, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
ans = max(min([s, v, j]) * f + min(j - min([s, v, j]), t) * e, min(t, j) * e + min(j - min(t, j), min(s, v)) * f)
print(ans)


(a, b, c, d, e, f) = [int(input()) for _ in range(6)]
suits1 = min(a, d)
suits2 = min(b, c, d)
total = 0
if e > f:
	total += suits1 * e
	total += min(suits2, d - suits1) * f if d - suits1 > 0 else 0
else:
	total += suits2 * f
	total += min(suits1, d - suits2) * e if d - suits2 > 0 else 0
print(total)


t = int(input())
sc = int(input())
v = int(input())
su = int(input())
c1 = int(input())
c2 = int(input())
c = 0
if c2 > c1:
	m = min(sc, v, su)
	c += c2 * m
	su = su - m
	if su > 0:
		m = min(t, su)
		c += c1 * m
else:
	m = min(t, su)
	c += c1 * m
	su = su - m
	if su > 0:
		m = min(sc, v, su)
		c += c2 * m
print(c)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f > e:
	p2 = min(d, b, c) * f
	new_d = d - min(d, b, c)
	p1 = min(a, new_d) * e
else:
	p1 = min(a, d) * e
	new_d = d - min(a, d)
	p2 = min(new_d, b, c) * f
final = p1 + p2
print(final)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
x1 = e * min(a, d) + f * min(d - min(a, d), b, c)
x2 = f * min(b, c, d) + e * min(d - min(b, c, d), a)
print(max(x1, x2))


from sys import stdin, stdout
ties = int(stdin.readline())
scarfs = int(stdin.readline())
vest = int(stdin.readline())
jackets = int(stdin.readline())
cost1 = int(stdin.readline())
cost2 = int(stdin.readline())

def compute_cost(cost1, cost2, t, s, v, j):
	if cost1 < cost2:
		count2 = min(min(j, s), v)
		j = j - count2
		count1 = min(t, j)
		return count2 * cost2 + count1 * cost1
	else:
		count1 = min(t, j)
		j = j - count1
		count2 = min(min(j, s), v)
		return count2 * cost2 + count1 * cost1
stdout.write(str(compute_cost(cost1, cost2, ties, scarfs, vest, jackets)) + '\n')


import sys
input = sys.stdin.readline
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
for i in range(d + 1):
	j = d - i
	x = min(i, a)
	y = min(j, b, c)
	ans = max(ans, x * e + y * f)
print(ans)


def f():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	poss2 = min(b, c)
	poss1 = a
	v2 = f
	v1 = e
	if poss1 + poss2 <= d:
		return v1 * poss1 + v2 * poss2
	if v1 < v2:
		(v1, v2) = (v2, v1)
		(poss1, poss2) = (poss2, poss1)
	if poss1 >= d:
		return d * v1
	return poss1 * v1 + (d - poss1) * v2
print(f())


t = int(input())
s = int(input())
v = int(input())
j = int(input())
C_1 = int(input())
C_2 = int(input())
if C_2 > C_1:
	A = min(s, v, j)
	J = j - A
	B = min(t, J)
	H = B * C_1
	I = A * C_2
	print(I + H)
elif C_1 > C_2:
	B = min(t, j)
	J = j - B
	A = min(s, v, J)
	H = B * C_1
	I = A * C_2
	print(I + H)
elif C_1 == C_2:
	B = min(t, j)
	J = j - B
	A = min(s, v, J)
	H = B * C_1
	I = A * C_2
	print(I + H)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
sum = 0
custf = True
custe = True
while True:
	if (f > e or custe == False) and (b > 0 and c > 0 and (d > 0)):
		sum += f
		b -= 1
		c -= 1
		d -= 1
		if b == 0 or c == 0 or d == 0:
			custf = False
	elif (e >= f or custf == False) and (a > 0 and d > 0):
		sum += e
		a -= 1
		d -= 1
		if a == 0 or d == 0:
			custe = False
	else:
		print(sum)
		break


import sys
input = sys.stdin.readline
from collections import *
l = [int(input()) for _ in range(6)]
(a, b, c, d, e, f) = l
ans = 0
for i in range(d + 1):
	ty1 = min(a, i)
	ty2 = min(b, c, d - i)
	ans = max(ans, ty1 * e + ty2 * f)
print(ans)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
c1 = int(input())
c2 = int(input())
if c1 > c2:
	k = min(v, s)
	print(min(t, j) * c1 + max(min(j - t, k), 0) * c2)
else:
	k = min(v, s)
	print(min(j, k) * c2 + max(min(j - k, t), 0) * c1)


import sys
input = sys.stdin.readline
A = [int(input()) for _ in range(6)]
ans = 0
for jac in range(A[3] + 1):
	first = min(jac, A[0])
	second = min([A[3] - jac, A[1], A[2]])
	ans = max(ans, first * A[4] + second * A[5])
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
s1 = [a, d]
s2 = [b, c, d]
if e >= f:
	s2[2] = d - min(s1)
	price = min(s1) * e + min(s2) * f
	print(price)
else:
	s1[1] = d - min(s2)
	p = min(s2) * f + min(s1) * e
	print(p)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
c1 = int(input())
c2 = int(input())
b = min(b, c)
cost = 0
if c1 < c2:
	k = min(d, b)
	d -= k
	b -= k
	cost += k * c2
	if d > 0:
		k = min(a, d)
		cost += k * c1
else:
	k = min(d, a)
	d -= k
	a -= k
	cost += k * c1
	if d > 0:
		k = min(b, d)
		cost += k * c2
print(cost)


l = [0, 0, 0, 0, 0, 0]
m = []
n = []
for i in range(6):
	l[i] = int(input())
m.append(min(l[1], l[2], l[3]) * l[5])
if l[3] > min(l[2], l[1]):
	m.append(min(l[3] - min(l[1], l[2]), l[0]) * l[4])
n.append(min(l[3], l[0]) * l[4])
l[3] = l[3] - min(l[3], l[0])
n.append(min(l[3], l[2], l[1]) * l[5])
print(max(sum(n), sum(m)))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
res = 0
if max(e, f) == f:
	while d != 0 and c != 0 and (b != 0):
		d -= 1
		c -= 1
		b -= 1
		res += f
	while d != 0 and a != 0:
		d -= 1
		a -= 1
		res += e
else:
	while d != 0 and a != 0:
		d -= 1
		a -= 1
		res += e
	while d != 0 and c != 0 and (b != 0):
		d -= 1
		c -= 1
		b -= 1
		res += f
print(res)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e > f:
	if d <= a:
		z = d * e
		print(z)
	elif a < d:
		z = a * e
		y = d - a
		li = [y, b, c]
		x = f * min(li)
		w = z + x
		print(w)
elif e == f:
	if b > a and c > a:
		if b > c:
			z = c * f
			y = d - c
			li = [y, a]
			x = e * min(li)
			if x > 0:
				w = z + x
				print(w)
			else:
				print(z)
		else:
			z = b * f
			y = d - b
			li = [y, a]
			x = f * min(li)
			w = z + x
			if x > 0:
				print(w)
			else:
				print(z)
	if a >= b or a >= c:
		if d <= a:
			z = d * e
			print(z)
		else:
			z = a * e
			y = d - a
			li = [y, b, c]
			x = f * min(li)
			k = z + x
			print(k)
elif e < f:
	li = [b, c, d]
	z = min(li) * f
	y = d - min(li)
	if y > a:
		k = a * e
		m = z + k
		print(m)
	else:
		k = y * e
		m = z + k
		print(m)


(a, b, c, d, e, f) = [int(input()) for _ in range(6)]
d1 = min(d, a) if e > f else min(d, b, c)
d2 = d - d1
d2 = min(d2, b, c) if e > f else min(d2, a)
print(d1 * e + d2 * f if e > f else d1 * f + d2 * e)


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	if e > f:
		m = min(a, d)
		(cost1, d) = (m * e, d - m)
		n = min(b, c, d)
		cost2 = n * f
		print(cost1 + cost2)
	else:
		n = min(b, c, d)
		(cost2, d) = (n * f, d - n)
		m = min(a, d)
		cost1 = m * e
		print(cost1 + cost2)
main()


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
e = int(input())
f = int(input())
if f >= e:
	mi = min(scarves, jackets, vests)
	scarves -= mi
	jackets -= mi
	vests -= mi
	tyt = min(jackets, ties)
	print(mi * f + tyt * e)
else:
	tyt = min(ties, jackets)
	ties -= tyt
	jackets -= tyt
	mi = min(scarves, vests, jackets)
	print(tyt * e + mi * f)


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin, stdout
from collections import defaultdict, deque
from math import log2, ceil, floor
inp = lambda : int(input())
sip = lambda : input()
mulip = lambda : map(int, input().split())
lst = lambda : list(map(int, input().split()))
slst = lambda : list(sip())
arr2d = lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x % 2 != 0, l)))
evens = lambda l: len(list(filter(lambda x: x % 2 == 0, l)))
mod = pow(10, 9) + 7
Judge = 0
if Judge:
	sys.stdin = open('input.in', 'r')
ff = inp()
b = inp()
c = inp()
tie = inp()
e = inp()
f = inp()
ss = min(b, c)
if e > f:
	print(e * min(ff, tie) + f * min(max(tie - ff, 0), ss))
elif e == f:
	print(e * min(tie, ss + ff))
else:
	print(e * min(max(tie - ss, 0), ff) + f * min(ss, tie))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
a = int(ri())
b = int(ri())
c = int(ri())
d = int(ri())
e = int(ri())
f = int(ri())
if f > e:
	temp = min(b, c, d)
	ans = 0
	ans += f * temp
	b -= temp
	c -= temp
	d -= temp
	ans += e * min(a, d)
	print(ans)
else:
	temp = min(a, d)
	ans = 0
	ans += e * temp
	d -= temp
	ans += f * min(d, b, c)
	print(ans)


ties = int(input())
scarves = int(input())
vests = int(input())
jackets = int(input())
suit1_cost = int(input())
suit2_cost = int(input())
res = 0
x = 0
if suit1_cost > suit2_cost:
	x = min(ties, jackets)
	res = x * suit1_cost + min(scarves, vests, jackets - x) * suit2_cost
else:
	x = min(scarves, vests, jackets)
	res = x * suit2_cost + min(ties, jackets - x) * suit1_cost
print(res)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
x = int(input())
y = int(input())
ans = 0
if x >= y:
	q = min(a, d)
	ans += q * x
	d -= q
	w = min(b, c, d)
	ans += w * y
else:
	q = min(b, c, d)
	ans += q * y
	d -= q
	w = min(a, d)
	ans += w * x
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if b < c:
	n = b
else:
	n = c
if e > f:
	p1 = e
	p2 = f
	s1 = a
	s2 = n
else:
	p1 = f
	p2 = e
	s1 = n
	s2 = a
if d < s1:
	cost = d * p1
else:
	cost = s1 * p1
	d = d - s1
	if d < s2:
		cost = cost + d * p2
	else:
		cost = cost + s2 * p2
print(cost)


z = lambda : int(input())
(a, b, c, d, e, f) = (z(), z(), z(), z(), z(), z())
s = 0
z = 0
if e >= f:
	z = d - min(d, a)
	s += e * min(d, a) + f * min(z, b, c)
	print(s)
else:
	z = d - min(d, b, c)
	s += f * min(d, b, c) + e * min(z, a)
	print(s)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f >= e:
	min2 = min(b, c, d)
	min1 = min(a, abs(d - min2))
	price = max(min1 * e, min2 * f, min1 * e + min2 * f)
else:
	min1 = min(a, d)
	min2 = min(b, c, abs(d - min1))
	price = max(min1 * e, min2 * f, min1 * e + min2 * f)
print(price)


from sys import stdin
ties = int(stdin.readline().strip())
scarves = int(stdin.readline().strip())
vests = int(stdin.readline().strip())
jackets = int(stdin.readline().strip())
e = int(stdin.readline().strip())
f = int(stdin.readline().strip())
cost = 0
if e > f:
	cost += e * min(ties, jackets)
	jackets -= min(ties, jackets)
	cost += f * min(scarves, vests, jackets)
else:
	cost += f * min(scarves, vests, jackets)
	jackets -= min(scarves, vests, jackets)
	cost += e * min(ties, jackets)
print(cost)


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
mod = 10 ** 9 + 7
a = int(input())
b = int(input())
c = int(input())
d = int(input())
d1 = d
e = int(input())
f = int(input())
ans = min(a, d)
c1 = e * ans
ans1 = min(b, c, d)
c2 = f * ans1
d -= ans
d1 -= ans1
ans = min(a, d1)
ans1 = min(b, c, d)
c1 += f * ans1
c2 += e * ans
print(max(c1, c2))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
sum = 0
while min(a, b, c, d):
	if e >= f:
		sum += e
		a -= 1
	else:
		sum += f
		c -= 1
		b -= 1
	d -= 1
while min(a, d):
	sum += e
	a -= 1
	d -= 1
while min(b, c, d):
	sum += f
	b -= 1
	c -= 1
	d -= 1
print(sum)


def answer():
	a1 = int(input())
	a2 = int(input())
	b2 = int(input())
	common = int(input())
	cost1 = int(input())
	cost2 = int(input())
	a = max(min(a1, common - min(common, a2, b2)) * cost1 + min(common, a2, b2) * cost2, min(common - min(common, a1), a2, b2) * cost2 + min(a1, common) * cost1)
	print(a)
answer()


import sys, math, queue, collections
MOD = 10 ** 9 + 7
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
if e > f:
	x = min(a, d)
	d -= x
	ans += x * e
	y = min(b, c, d)
	ans += y * f
else:
	y = min(b, c, d)
	d -= y
	ans += y * f
	x = min(a, d)
	ans += x * e
print(ans)


from sys import stdin
import math

def input():
	return stdin.readline()[:-1]
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
(type1, type2) = (0, 0)
if e >= f:
	type1 = min(a, d)
	d -= type1
	type2 = min(b, c, d)
else:
	type2 = min(b, c, d)
	d -= type2
	type1 = min(a, d)
print(e * type1 + f * type2)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
mx = 0
if e >= f:
	if a >= d:
		mx += e * d
	else:
		mx += e * a
		mx += min(d - a, c, b) * f
elif b >= d and c >= d:
	mx += f * d
else:
	mx += f * min(b, c)
	mx += e * min(d - min(b, c), a)
print(mx)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
g = min(a, d) * e + min(d - min(a, d), b, c) * f
h = min(d, c, b) * f + min(a, d - min(d, c, b)) * e
print(max(h, g))


tie = int(input())
scarves = int(input())
vest = int(input())
jackets = int(input())
e = int(input())
f = int(input())
if f > e:
	print(f * min(scarves, vest, jackets) + e * min(tie, jackets - min(scarves, vest, jackets)))
else:
	print(e * min(tie, jackets) + f * min(min(scarves, vest), jackets - min(tie, jackets)))


t = int(input())
s = int(input())
v = int(input())
j = int(input())
c1 = int(input())
c2 = int(input())
if c1 >= c2:
	res = c1 * min(t, j) + c2 * min(j - min(t, j), min(s, min(v, j)))
else:
	res = c2 * min(s, min(v, j)) + c1 * min(abs(j - min(s, min(v, j))), t)
print(res)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f >= e:
	x = min(b, c, d)
	c1 = x * f
	d = d - x
	h = min(a, d)
	o = h * e
	print(c1 + o)
if e > f:
	x = min(a, d)
	c1 = x * e
	d = d - x
	h = min(b, c, d)
	o = h * f
	print(c1 + o)


def solve():
	ties_nr = int(input())
	scarfs_nr = int(input())
	gilets_nr = int(input())
	jackets_nr = int(input())
	tie_jacket_price = int(input())
	sc_gl_jck_price = int(input())
	if tie_jacket_price > sc_gl_jck_price:
		ans = tie_jacket_price * min(ties_nr, jackets_nr)
		jackets_nr -= min(ties_nr, jackets_nr)
		ans += sc_gl_jck_price * min((scarfs_nr, gilets_nr, jackets_nr))
	else:
		ans = sc_gl_jck_price * min((scarfs_nr, gilets_nr, jackets_nr))
		jackets_nr -= min((scarfs_nr, gilets_nr, jackets_nr))
		ans += tie_jacket_price * min(ties_nr, jackets_nr)
	print(ans)
solve()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = 0
if e != f:
	first = max(e, f)
	if first == f:
		ans += min(b, c, d) * f
		if ans // f < d:
			ans += min(a, d - ans // f) * e
	else:
		ans += min(a, d) * e
		if ans // e < d:
			ans += min(b, c, d - ans // e) * f
elif min(a, d) >= min(b, c, d):
	ans += min(a, d) * e
	if ans // e < d:
		ans += min(b, c, d - ans // e) * f
else:
	ans += min(b, c, d) * f
	if ans // f < d:
		ans += min(a, d - ans // f) * e
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
m = min(b, c, d)
d1 = d - m
n = min(a, d1)
n1 = min(a, d)
d2 = d - n1
m1 = min(b, c, d2)
if f > e:
	cost = e * n + f * m
else:
	cost = e * n1 + f * m1
print(cost)


cost = 0
l = []
for i in range(0, 6):
	l.append(int(input()))
(a, b, c, d, x, y) = l
u = min(x, y)
if u == x:
	v1 = min(b, c, d)
	cost = v1 * y
	d = d - v1
	cost += min(a, d) * x
else:
	v1 = min(a, d)
	cost = v1 * x
	d = d - v1
	cost += min(b, c, d) * y
print(cost)


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7
a = INT()
b = INT()
c = INT()
d = INT()
e = INT()
f = INT()
b = min(b, c)
ans = 0
if e >= f:
	if a >= d:
		ans = d * e
	else:
		ans += a * e
		d -= a
		ans += min(b, d) * f
elif b >= d:
	ans = d * f
else:
	ans += b * f
	d -= b
	ans += min(a, d) * e
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
maxx1 = max(e, f)
if f > e:
	summ1 = min(b, c, d) * maxx1
	val1 = d - min(b, c, d)
	summ1 = summ1 + e * min(a, val1)
	print(summ1)
elif e > f:
	summ2 = min(a, d) * maxx1
	val2 = d - min(a, d)
	summ2 = summ2 + f * min(b, c, val2)
	print(summ2)
else:
	summ1 = min(b, c, d) * maxx1
	val1 = d - min(b, c, d)
	summ1 = summ1 + e * min(a, val1)
	summ2 = min(a, d) * maxx1
	val2 = d - min(a, d)
	summ2 = summ2 + f * min(b, c, val2)
	print(max(summ1, summ2))


arr = []
for i in range(6):
	arr.append(int(input()))
e = arr[4]
f = arr[5]
ecost = min(arr[0], arr[3]) * e + min(arr[1], arr[2], arr[3] - min(arr[0], arr[3])) * f
fcost = min(arr[1:4]) * f + min(arr[0], arr[3] - min(arr[1:4])) * e
print(max(ecost, fcost))


import sys
(a, b, c, d, e, f) = map(int, sys.stdin.readlines())
cost = 0
if e >= f:
	cost += e * min(a, d)
	cost += f * min(b, c, d - min(a, d))
else:
	cost += f * min(b, c, d)
	cost += e * min(a, d - min(b, c, d))
print(cost)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e >= f:
	n_e = min(a, d)
	d -= n_e
	n_f = min(b, c, d)
if e < f:
	n_f = min(b, c, d)
	d -= n_f
	n_e = min(a, d)
	a -= n_e
	d -= n_e
print(e * n_e + f * n_f)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
max_1 = a
max_2 = min(b, c)
ans = 0
if e >= f:
	ans += min(d, max_1) * e
	d -= min(d, max_1)
	ans += min(d, max_2) * f
else:
	ans += min(d, max_2) * f
	d -= min(d, max_2)
	ans += min(d, max_1) * e
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
first = min(a, d)
second = min(b, c, d)
max_val = second * f
max_val += max(0, min(a, d - second)) * e
max2val = first * e
max2val += max(0, min(b, c, d - first)) * f
print(max(max2val, max_val))


t = int(input())
s = int(input())
v = int(input())
j = int(input())
t1 = int(input())
t2 = int(input())
x = 0
if t1 >= t2:
	x = min(t, j)
	t -= x
	j -= x
	x2 = min(s, v, j)
	print(x * t1 + x2 * t2)
else:
	x = min(s, v, j)
	s -= x
	v -= x
	j -= x
	x2 = min(t, j)
	print(x * t2 + x2 * t1)


from sys import stdin, stdout
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
one = min(a, d)
two = min(b, c, d)
p1 = one * e + (1 if d - one > 0 else 0) * min(two, d - one) * f
p2 = two * f + (1 if d - two > 0 else 0) * min(one, d - two) * e
print(max(p1, p2))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	a = int(inp())
	b = int(inp())
	c = int(inp())
	d = int(inp())
	e = int(inp())
	f = int(inp())
	ans = 0
	if e > f:
		ans += min(d, a) * e
		if d > a:
			ans += min(d - min(d, a), b, c) * f
	else:
		ans += min(d, b, c) * f
		if min(d, b, c) != d:
			ans += min(a, d - min(b, c, d)) * e
	print(ans)
testcase(1)


t = 1
while t:
	ti = int(input())
	s = int(input())
	v = int(input())
	j = int(input())
	e = int(input())
	f = int(input())
	if e > f:
		k = min(ti, j)
		j -= k
		ans = e * k
		ans += min(j, s, v) * f
	elif e == f:
		if min(ti, j) > min(j, s, v):
			k = min(ti, j)
			j -= k
			ans = e * k
			ans += min(j, s, v) * f
		else:
			k = min(j, s, v)
			j -= k
			ans = k * f
			ans += min(ti, j) * e
	else:
		k = min(s, v, j)
		j -= k
		ans = k * f
		ans += min(ti, j) * e
	print(ans)
	t -= 1


def first(t, j):
	if t < j:
		m = t
	else:
		m = j
	return (m, t - m, j - m)

def second(s, v, j):
	if j < v:
		m = j
	else:
		m = v
	if m > s:
		m = s
	return (m, s - m, v - m, j - m)
t = int(input())
s = int(input())
v = int(input())
j = int(input())
fc = int(input())
sc = int(input())
if sc > fc:
	(n, s, v, j) = second(s, v, j)
	(m, t, j) = first(t, j)
else:
	(m, t, j) = first(t, j)
	(n, s, v, j) = second(s, v, j)
print(n * sc + m * fc)


import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split(' ')]

def st():
	return input().rstrip('\n')

def val():
	return int(input())

def li2():
	return [i for i in input().rstrip('\n').split(' ')]
a = val()
b = val()
c = val()
d = val()
e = val()
f = val()
tot = 0
if e > f:
	tot += min(d, a) * e
	d -= min(d, a)
	tot += min(c, b, d) * f
else:
	tot += min(c, b, d) * f
	d -= min(c, b, d)
	tot += min(d, a) * e
print(tot)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())

def f1():
	if d <= a:
		p = d * e
		q = 0
	else:
		p = a * e
		x = d - a
		l = [x, b, c]
		q = min(l) * f
	return p + q

def f2():
	if d <= b and d <= c:
		p = d * f
		q = 0
	else:
		p = min([b, c]) * f
		x = d - min([b, c])
		l = [x, a]
		q = min(l) * e
	return p + q
r = f1()
s = f2()
if r >= s:
	print(r)
else:
	print(s)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
max_suit1 = min(a, d)
max_suit2 = min(b, c, d)
cost = 0
if e > f:
	cost += max_suit1 * e + min(b, c, d - max_suit1) * f
elif f > e:
	cost += max_suit2 * f + min(a, d - max_suit2) * e
elif max_suit1 > max_suit2:
	cost += max_suit1 * e + min(b, c, d - max_suit1) * f
else:
	cost += max_suit2 * f + min(a, d - max_suit2) * e
print(cost)


def efind(a, b, c, d, e, f):
	ans = 0
	no = min(a, d)
	ans = no * e
	a -= no
	d -= no
	ans += f * min(b, c, d)
	return ans

def ffind(a, b, c, d, e, f):
	ans = 0
	no = min(b, c, d)
	ans += f * no
	c -= no
	b -= no
	d -= no
	ans += e * min(a, d)
	return ans
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
ans = max(efind(a, b, c, d, e, f), ffind(a, b, c, d, e, f))
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if e < f:
	min2 = min([b, c, d])
	sub2 = d - min2
	if a < sub2:
		print(min2 * f + a * e)
	else:
		print(min2 * f + sub2 * e)
else:
	min1 = min([a, d])
	sub1 = d - min1
	min3 = min([b, c, sub1])
	print(min1 * e + min3 * f)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
suit1 = [a]
suit2 = [b, c]
price = []

def minimum(l):
	mini = l[0]
	for i in range(len(l)):
		if l[i] <= mini:
			mini = l[i]
	return mini

def miximum(l):
	mixi = l[0]
	for k in range(len(l)):
		if l[k] >= mixi:
			mixi = l[k]
	return mixi
for j in range(d + 1):
	suit1.append(j)
	suit2.append(d - j)
	elmnt = e * minimum(suit1) + f * minimum(suit2)
	price.append(elmnt)
	suit1.pop()
	suit2.pop()
print(miximum(price))


(T, S, V, J, Fi, Se) = (int(input()), int(input()), int(input()), int(input()), int(input()), int(input()))
Pick1 = min(T, J)
Pick2 = min(S, V, J - Pick1)
Pick3 = min(S, V, J)
Pick4 = min(T, J - Pick3)
print(max(Pick1 * Fi + Pick2 * Se, Pick4 * Fi + Pick3 * Se))


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def main():
	a = []
	ans = 0
	for i in range(6):
		i = inin()
		a.append(i)
	if a[4] < a[5]:
		x = min(a[1], a[2])
		x = min(x, a[3])
		ans += x * a[5]
		a[3] -= x
		y = min(a[3], a[0])
		ans += y * a[4]
	else:
		y = min(a[3], a[0])
		ans += y * a[4]
		a[3] -= y
		x = min(a[1], a[2])
		x = min(x, a[3])
		ans += x * a[5]
	print(ans)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


t = int(input())
s = int(input())
v = int(input())
j = int(input())
a = int(input())
b = int(input())
ans = []
for i in range(j + 1):
	p1 = i
	p2 = j - i
	p11 = min(t, p1)
	p12 = min(s, v, p2)
	ans.append(p11 * a + p12 * b)
print(max(ans))


a = int(input())
b = int(input())
c = int(input())
b = min(b, c)
d = int(input())
e = int(input())
f = int(input())
ans = 0
if e > f:
	while a > 0 and d > 0:
		ans += e
		a -= 1
		d -= 1
	while b > 0 and d > 0:
		ans += f
		b -= 1
		d -= 1
else:
	while b > 0 and d > 0:
		ans += f
		b -= 1
		d -= 1
	while a > 0 and d > 0:
		ans += e
		a -= 1
		d -= 1
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
if f > e:
	tmp = 0
	if b > c:
		tmp = c
	else:
		tmp = b
	if tmp >= d:
		print(d * f)
	else:
		s = tmp * f
		d = d - tmp
		if d > a:
			print(s + a * e)
		else:
			print(s + d * e)
elif a > d:
	print(d * e)
else:
	s = a * e
	d = d - a
	tmp = 0
	if b > c:
		tmp = c
	else:
		tmp = b
	if tmp >= d:
		print(s + d * f)
	else:
		print(s + tmp * f)


inp = []
for _ in range(6):
	inp.append(int(input()))
(a, b, c, d, e, f) = (inp[0], inp[1], inp[2], inp[3], inp[4], inp[5])
if e > f:
	print(e * min(a, d) + f * min(min(b, c), d - min(a, d)))
else:
	print(f * min(min(b, c), d) + e * min(a, d - min(min(b, c), d)))


import sys
import collections
input = sys.stdin.readline

def printnl(val):
	sys.stdout.write(str(val) + '\n')
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
a = min(a, d)
b = min(b, c)
b = min(b, d)
if a + b > d:
	if e > f:
		b = d - a
	else:
		a = d - b
print(a * e + b * f)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
prof = 0
if e > f:
	w = min(a, d)
	prof += w * e
	a = a - w
	d = d - w
	w = min(b, c, d)
	prof += w * f
	b = b - w
	c = c - w
	d = d - w
	print(prof)
else:
	w = min(b, c, d)
	prof += w * f
	b = b - w
	c = c - w
	d = d - w
	w = min(a, d)
	prof += w * e
	a = a - w
	d = d - w
	print(prof)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
t = 0
if f >= e:
	q = min(b, c, d)
	t += f * q
	d -= q
	q1 = min(a, d)
	t += e * q1
elif e > f:
	q1 = min(a, d)
	d -= q1
	t += e * q1
	q = min(b, c, d)
	t += f * q
print(t)


(a, b, c, d, e, f) = [int(input()) for _ in range(6)]
ad = min(a, d)
bc = min(b, c)
bcd = min(bc, d)
if e < f:
	print(f * bcd + min(d - bcd, a) * e)
else:
	print(e * ad + f * min(d - ad, bc))


import sys
t = 1
for i in range(t):
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	f = int(input())
	op = 0
	y = min(b, c, d)
	x = min(a, d - y)
	op = y * f + e * x
	for i in range(y):
		op = max(op, i * f + e * min(a, d - i))
	print(op)


t = int(input())
s = int(input())
v = int(input())
j = int(input())
e = int(input())
f = int(input())
if e < f:
	x = min(s, v, j)
	p1 = x * f
	p = j - x
	z = min(t, p)
	p2 = z * e
	print(p1 + p2)
else:
	x = min(t, j)
	p1 = x * e
	p = j - x
	z = min(s, v, p)
	p2 = z * f
	print(p1 + p2)