Q,H,S,D = (int(i) for i in input().split())

N = int(eval(input()))



q = Q*4

h = H*2

s = S

d = D/2



if min(q,h,s,d)==d:

    if N%2 == 0:

        money = D*(N//2)

    else:

        money = (N//2)*D + min(q,h,s)

else:

    money = min(q,h,s)*N



print((int(money)))
Q,H,S,D = (int(i) for i in input().split())

N = int(eval(input()))



Qper025L = Q

Hper025L = H / 2

Sper025L = S / 4

Dper025L = D / 8



teainfo = [["Q",Qper025L,Q,0.25],["H",Hper025L,H,0.50],["S",Sper025L,S,1],["D",Dper025L,D,2]]



sortedtea = sorted(teainfo, key = lambda x:(x[1],x[2]), reverse = False)



price = 0



for i in range(4):

    if sortedtea[i][3] <= N:

        numbottles = int(N / sortedtea[i][3])

        N -= sortedtea[i][3] * numbottles

        price += sortedtea[i][2] * numbottles



print((int(price)))
Q, H, S, D = (int(i) for i in input().split())
N = int(eval(input()))
q = Q * 4
h = H * 2
s = S
d = D / 2
if min(q, h, s, d) == d:
    if N % 2 == 0:
        money = D * (N // 2)
    else:
        money = (N // 2) * D + min(q, h, s)
else:
    money = min(q, h, s) * N
print((int(money)))

Q, H, S, D = (int(i) for i in input().split())
N = int(eval(input()))
Qper025L = Q
Hper025L = H / 2
Sper025L = S / 4
Dper025L = D / 8
teainfo = [
    ["Q", Qper025L, Q, 0.25],
    ["H", Hper025L, H, 0.50],
    ["S", Sper025L, S, 1],
    ["D", Dper025L, D, 2],
]
sortedtea = sorted(teainfo, key=lambda x: (x[1], x[2]), reverse=False)
price = 0
for i in range(4):
    if sortedtea[i][3] <= N:
        numbottles = int(N / sortedtea[i][3])
        N -= sortedtea[i][3] * numbottles
        price += sortedtea[i][2] * numbottles
print((int(price)))

-q = Q * 4 -h = H * 2 -s = S -d = D / 2 -if min(q, h, s, d) == d: -    if N % 2 == 0: -        money = D * (N // 2) -    else: -        money = (N // 2) * D + min(q, h, s) -else: -    money = min(q, h, s) * N -print((int(money))) +Qper025L = Q +Hper025L = H / 2 +Sper025L = S / 4 +Dper025L = D / 8 +teainfo = [ +    ["Q", Qper025L, Q, 0.25], +    ["H", Hper025L, H, 0.50], +    ["S", Sper025L, S, 1], +    ["D", Dper025L, D, 2], +] +sortedtea = sorted(teainfo, key=lambda x: (x[1], x[2]), reverse=False) +price = 0 +for i in range(4): +    if sortedtea[i][3] <= N: +        numbottles = int(N / sortedtea[i][3]) +        N -= sortedtea[i][3] * numbottles +        price += sortedtea[i][2] * numbottles +print((int(price)))