Vasya often uses public transport. The transport in the city is of two types: trolleys and buses. The city has n buses and m trolleys, the buses are numbered by integers from 1 to n, the trolleys are numbered by integers from 1 to m.

Public transport is not free. There are 4 types of tickets:   A ticket for one ride on some bus or trolley. It costs c_1 burles;  A ticket for an unlimited number of rides on some bus or on some trolley. It costs c_2 burles;  A ticket for an unlimited number of rides on all buses or all trolleys. It costs c_3 burles;  A ticket for an unlimited number of rides on all buses and trolleys. It costs c_4 burles. 

Vasya knows for sure the number of rides he is going to make and the transport he is going to use. He asked you for help to find the minimum sum of burles he will have to spend on the tickets.


-----Input-----

The first line contains four integers c_1, c_2, c_3, c_4 (1 ≤ c_1, c_2, c_3, c_4 ≤ 1000) — the costs of the tickets.

The second line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of buses and trolleys Vasya is going to use.

The third line contains n integers a_{i} (0 ≤ a_{i} ≤ 1000) — the number of times Vasya is going to use the bus number i.

The fourth line contains m integers b_{i} (0 ≤ b_{i} ≤ 1000) — the number of times Vasya is going to use the trolley number i.


-----Output-----

Print a single number — the minimum sum of burles Vasya will have to spend on the tickets.


-----Examples-----
Input
1 3 7 19
2 3
2 5
4 4 4

Output
12

Input
4 3 2 1
1 3
798
1 2 3

Output
1

Input
100 100 8 100
3 5
7 94 12
100 1 47 0 42

Output
16



-----Note-----

In the first sample the profitable strategy is to buy two tickets of the first type (for the first bus), one ticket of the second type (for the second bus) and one ticket of the third type (for all trolleys). It totals to (2·1) + 3 + 7 = 12 burles.

In the second sample the profitable strategy is to buy one ticket of the fourth type.

In the third sample the profitable strategy is to buy two tickets of the third type: for all buses and for all trolleys.

Difficulty: interview

Starter code:

Solutions:
c = list(map(int, input().split()))
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sa = sum(a)*c[0]
sb = sum(b)*c[0]

for i in a:
    sa = min(sa, sa - i*c[0] + c[1])
for i in b:
    sb = min(sb, sb - i*c[0] + c[1])
print(min(sa + sb, sa + c[2], sb + c[2], c[2] + c[2], c[3]))


c1,c2,c3,c4=list(map(int,input().split()))

n,m=list(map(int,input().split()))
B=list(map(int,input().split()))

T=list(map(int,input().split()))

if(sum(B)==0):
    C=0
    for item in T:
        if(item*c1>c2):
            C+=c2
        else:
            C+=item*c1
    print(min((C,c4,c3)))

elif(sum(T)==0):
    C=0
    for item in B:
        if(item*c1>c2):
            C+=c2
        else:
            C+=item*c1
    print(min((C,c4,c3)))

else:
    A=0
    for item in T:
        if(item*c1>c2):
            A+=c2
        else:
            A+=item*c1
    Q=0
    for item in B:
        if(item*c1>c2):
            Q+=c2
        else:
            Q+=item*c1
    print(min((A+Q,c3+c3,c4,A+c3,Q+c3)))
        


c1, c2, c3, c4 = map(int, input().split())
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sum1 = 0
for i in range(n):
    sum1 += min(a[i] * c1, c2)
sum2 = 0
for i in range(m):
    sum2 += min(b[i] * c1, c2)
print(min(c4, 2 * c3, c3 + sum1, c3 + sum2, sum1 + sum2))

c1, c2, c3, c4 = map(int, input().split())
n, m = map(int, input().split())
bus = list(map(int, input().split()))
trol = list(map(int, input().split()))

mbus = [0] * n
mtrol = [0] * m

for i in range (n):
    mbus[i] = min(bus[i] * c1, c2)
sbus = min(sum(mbus), c3)

for i in range (m):
    mtrol[i] = min(trol[i] * c1, c2)
strol = min(sum(mtrol), c3)

res = min(sbus + strol, c4)

print(res)

def __starting_point():
    arr = input().split(' ')
    c = []
    for a in arr:
        c.append(int(a))
    ans = min(c[3],2*c[2])
    arr = input().split(' ')
    n = int(arr[0])
    m = int(arr[1])
    an = []
    am = []
    arr = input().split(' ')
    for a in arr:
        an.append(int(a))
    arr = input().split(' ')
    for a in arr:
        am.append(int(a))
    ca = 0
    for a in an:
        if a*c[0]<c[1]:
            ca+=a*c[0]
        else:
            ca+=c[1]
    ca=min(ca,c[2])
    cb = 0
    for a in am:
        if a*c[0]<c[1]:
            cb+=a*c[0]
        else:
            cb+=c[1]
    cb = min(cb,c[2])
    ans = min(ans,ca+cb)
    print(ans)
            

__starting_point()

c1,c2,c3 ,c4 = map(int,input().split())
n , m = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
ans1 = 0
ans2 = 0
for i in a:
    ans1 += min(c1 * i,c2)
ans1 = min(ans1, c3)
for i in b:
    ans2 += min(c1 * i,c2)
ans2 = min(ans2, c3)
ans = min(ans1 + ans2, c4)
print(ans)

#PublicTransport:

costs = input().split(" ")
costs = [int(x) for x in costs]
data = input().split(" ")
totalBuses = int(data[0])
totalTrolleys = int(data[1])
buses = input().split(" ")
trolleys = input().split(" ")
buses = [int(x) for x in buses]
trolleys = [int(x) for x in trolleys]

possibleCosts = [0,0,0,0]

totalBusTravels = sum(buses)
totalTrolleysTravels = sum(trolleys)

cost = [0,0]
#Buses
for busCost in buses:
	if busCost*costs[0] > costs[1]:
		cost[0] += costs[1]
	else:
		cost[0] += busCost*costs[0]
if cost[0] > costs[2]:
	cost[0] = costs[2]
# Trolleys
for trolleyCost in trolleys:
	if trolleyCost*costs[0] > costs[1]:
		cost[1] += costs[1]
	else:
		cost[1] += trolleyCost*costs[0]
if cost[1] > costs[2]:
	cost[1] = costs[2]

if cost[0]+cost[1] > costs[3]:
	print(costs[3])
else:
	print(cost[0]+cost[1])



c1,c2,c3,c4=map(int,input().split())
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
s=[]
s0=0
for i in range(n):
    s.append(min(a[i]*c1,c2))
    s0+=s[i]
s1=[]
s10=0
for i in range(m):
    s1.append(min(b[i]*c1,c2))
    s10+=s1[i]
print(min((min(s0,c3)+min(s10,c3)),c4))

a,b,c,d = map(int, input().split())
n, m = map(int, input().split())
t = list(map(int, input().split()))
h = list(map(int, input().split()))
v = []
w = []
for i in t:
    v.append(min(a*i, b))
for i in h:
    w.append(min(a*i,b))
t = min(c,sum(v))
h = min(c,sum(w))
print(min(d,t+h))

c1,c2,c3,c4=map(int, input().split())
n,m=map(int, input().split())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
mn1,mn2=0,0
for i in range(n):
    if(a[i]<c2//c1+1):
        mn1+=c1*a[i]
    else:
        mn1+=c2
for i in range(m):
    if(b[i]<c2//c1+1):
        mn2+=c1*b[i]
    else:
        mn2+=c2
print(min(c4,2*c3,mn1+c3,mn2+c3,mn1+mn2))

c1,c2,c3,c4 = list(map(int, input().split()))
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
suma = sum(min(c1*x, c2) for x in a)
sumb = sum(min(c1*x, c2) for x in b)
print(min(min(suma,c3) + min(sumb, c3), c4))


def inputi():
	a = input().split(" ")
	return [int(i) for i in a]
	
c1,c2,c3,c4 = inputi()
n,m = inputi()
a=inputi()
b=inputi()
sumn = 0
summ = 0
for i in a:
	if c1*i<c2:
		sumn=sumn+c1*i
	else:
		sumn=sumn+c2
if sumn > c3:
	sumn=c3
for i in b:
	if c1*i<c2:
		summ=summ+c1*i
	else:
		summ=summ+c2
if summ > c3:
	summ=c3
if sumn + summ > c4:
	print(c4)
else:
	print(sumn+summ)


import sys

# input
line_id = 0
for line in sys.stdin:
    line_id = line_id + 1
    line_data = line.split()

    if line_id <= 2:
        if line_id == 1:
            c1 = int(line_data[0])
            c2 = int(line_data[1])
            c3 = int(line_data[2])
            c4 = int(line_data[3])
        else:
            cnt_bus = int(line_data[0])
            cnt_tro = int(line_data[1])
    else:
        if line_id == 3:
            cnt_bus_took = [0]
            for data_str in line_data:
                cnt_bus_took.append(int(data_str))
        else:
            cnt_tro_took = [0]
            for data_str in line_data:
                cnt_tro_took.append(int(data_str))

# calc min cost for bus
cost_bus = 0
for bus_id in range(cnt_bus + 1):
    cost_bus = cost_bus + min(c1 * cnt_bus_took[bus_id], c2)
cost_bus = min(c3, cost_bus)

# calc min cost for tro
cost_tro = 0
for tro_id in range(cnt_tro + 1):
    cost_tro = cost_tro + min(c1 * cnt_tro_took[tro_id], c2)
cost_tro = min(c3, cost_tro)

# calc min cost for all (bus and tro)
cost_all = min(c4, cost_bus + cost_tro)
print(cost_all)


import sys
for line in sys.stdin:
    cost = 0
    c1,c2,c3,c4 = [int(x) for x in line.split()]
    line = next(sys.stdin)
    n, m = [int(x) for x in line.split()]
    line = next(sys.stdin)
    a = [int(x) for x in line.split()]
    line = next(sys.stdin)
    b = [int(x) for x in line.split()]
    cost1 = 0
    for x in a:
        cost1 += min(x * c1, c2)
    cost1 = min(cost1, c3)
    
    cost2 = 0
    for x in b:
        cost2 += min(x * c1, c2)
    cost2 = min(cost2, c3)
    cost = min(c4, cost1 + cost2)
    print(cost)


c = list(map(int, input().split()))
n, m = map(int, input().split())
p, q = list(map(int, input().split())), list(map(int, input().split()))
print(min(c[3], min(c[2], sum(min(c[0] * i, c[1]) for i in p)) + min(c[2], sum(min(c[0] * i, c[1]) for i in q))))    

import sys;

c1, c2, c3, c4 = map(int, sys.stdin.readline().split(' '));
nbBuses, nbTrolleys = map(int, sys.stdin.readline().split(' '));

buses = map(int, sys.stdin.readline().split(' '));
trolleys = map(int, sys.stdin.readline().split(' '));

minBusesCost = 0;
for nbRide in buses:
	minBusesCost += min(c2, nbRide * c1);

minTrolleysCost = 0;
for nbRide in trolleys:
	minTrolleysCost += min(c2, nbRide * c1);

# print(c1, c2, c3, c4, minBusesCost, minTrolleysCost);

minCost = min(
	c4,
	min(
		c3,
		minBusesCost
	) +
	min(
		c3,
		minTrolleysCost
	)
);
print(minCost);

def readln(): return tuple(map(int, input().split()))

c = readln()
n, m = readln()
a = readln()
b = readln()

va = min(sum([min(c[1], c[0] * _) for _ in a]), c[2])
vb = min(sum([min(c[1], c[0] * _) for _ in b]), c[2])

print(min(va + vb, c[3]))


def p(f):
    r=0
    for x in f:
        if x*a>b:
            r+=b
        else:
            r+=x*a
    return r

scan=lambda:map(int,input().split())
a,b,c,d=scan()
n,m=scan()
f=list(scan())
g=list(scan())
r1=p(f)
if r1>c:
    r1=c
r2=p(g)
if r2>c:
    r2=c
r=r1+r2
if r>d:
    r=d
print(r)

c = [int(x) for x in input().split()]
n, m = list(map(int, input().split()))
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
bu = min(c[2], sum(min(c[1], c[0] * ai) for ai in a))
tr = min(c[2], sum(min(c[1], c[0] * bi) for bi in b))
print(min(c[3], bu + tr))


c = [int(x) for x in input().split()]
n, m = (int(x) for x in input().split())
a = b = 0
for x in input().split():
	x = int(x)
	a += min(x * c[0], c[1])
for x in input().split():
	x = int(x)
	b += min(x * c[0], c[1])
print(min(c[3], min(c[2], a) + min(c[2], b)))


def main():
    c1, c2, c3, c4 = list(map(int, input().split()))
    input()
    aa = list(map(int, input().split()))
    bb = list(map(int, input().split()))
    t = c2 // c1
    c5, c6 = (sum(c1 * x if x <= t else c2 for x in l) for l in (aa, bb))
    print(min(c3 * 2, c3 + c5, c3 + c6, c5 + c6, c4))


def __starting_point():
    main()

__starting_point()

c1, c2, c3, c4 = map(int, input().split())

n, m = map(int, input().split())

bus = list(map(int, input().split()))

p = c2 // c1
for idx in range(n):
    if bus[idx] > 0:
        if bus[idx] > p:
            bus[idx] = c2
        else:
            bus[idx] = bus[idx] * c1

b_total = min(sum(bus), c3)

trol = list(map(int, input().split()))

for idx in range(m):
    if trol[idx] > 0:
        if trol[idx] > p:
            trol[idx] = c2
        else:
            trol[idx] = trol[idx] * c1
t_total = min(sum(trol), c3)

print(min(b_total + t_total, c4))

c1, c2, c3, c4 = list(map(int, input().split()))
n, m = list(map(int, input().split()))
lst1 = list(map(int, input().split()))
lst2 = list(map(int, input().split()))
buss = 0
for i in lst1:
    buss += min(c1 * i, c2)
buss = min(buss, c3)

tr = 0
for i in lst2:
    tr += min(c1 * i, c2)
tr = min(tr, c3)

print(min(c4, buss + tr))


c1, c2, c3, c4 = list(map(int, input().split()))
n, m = list(map(int, input().split()))
lst1 = list(map(int, input().split()))
lst2 = list(map(int, input().split()))
buss = 0
for i in lst1:
    buss += min(c1 * i, c2)
buss = min(buss, c3)

tr = 0
for i in lst2:
    tr += min(c1 * i, c2)
tr = min(tr, c3)

print(min(c4, buss + tr))


from math import floor
c1, c2, c3, c4 = list(map(int, input().split()))
n, m = list(map(int, input().split()))
# TODO worth doing a test it analysis
bus = [int(x) for x in input().split()]
trol = [int(x) for x in input().split()]


thres = floor(c2/c1)

## calculate bus side
bus_res = 0
for v in bus:
    if v>thres:
        bus_res += c2
    else:
        bus_res += (v * c1)

bus = min(c3, bus_res)


trol_res = 0
for v in trol:
    if v>thres:
        trol_res += c2
    else:
        trol_res += (v * c1)

trol = min(c3, trol_res)

print(min((bus + trol), c4))