q,h,s,d = list(map(int,input().split()))

n = int(eval(input()))

twoL = min(q*8,4*h,2*s,d)

oneL = min(q*4,2*h,s)

p = (n//2)*twoL + (n%2)*oneL

print(p)

Q,H,S,D=list(map(int,input().split()))

N=int(eval(input()))

ans=0

#each 2L

ans+=(N//2)*min([8*Q,4*H,2*S,D])

#1L

ans+=(N%2)*min([4*Q,2*H,S])

print(ans)
q, h, s, d = list(map(int, input().split()))
n = int(eval(input()))
twoL = min(q * 8, 4 * h, 2 * s, d)
oneL = min(q * 4, 2 * h, s)
p = (n // 2) * twoL + (n % 2) * oneL
print(p)

Q, H, S, D = list(map(int, input().split()))
N = int(eval(input()))
ans = 0
# each 2L
ans += (N // 2) * min([8 * Q, 4 * H, 2 * S, D])
# 1L
ans += (N % 2) * min([4 * Q, 2 * H, S])
print(ans)

-q, h, s, d = list(map(int, input().split())) -n = int(eval(input())) -twoL = min(q * 8, 4 * h, 2 * s, d) -oneL = min(q * 4, 2 * h, s) -p = (n // 2) * twoL + (n % 2) * oneL -print(p) +Q, H, S, D = list(map(int, input().split())) +N = int(eval(input())) +ans = 0 +# each 2L +ans += (N // 2) * min([8 * Q, 4 * H, 2 * S, D]) +# 1L +ans += (N % 2) * min([4 * Q, 2 * H, S]) +print(ans)