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

N = int(eval(input()))



PS = [[Q * 8, 0.25], [H * 4, 0.5], [S * 2, 1], [D, 2]]



PS.sort(key=lambda x: x[0])





R = N

ans = 0

for i in range (4):

    if R == 0:

        break

    elif R >= PS[i][1]:

        ans += int(PS[i][0] * PS[i][1] // 2 * (R // PS[i][1]))

        R = R % PS[i][1]



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

N = int(eval(input()))



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



print(ans)
Q, H, S, D = list(map(int, input().split()))
N = int(eval(input()))
PS = [[Q * 8, 0.25], [H * 4, 0.5], [S * 2, 1], [D, 2]]
PS.sort(key=lambda x: x[0])
R = N
ans = 0
for i in range(4):
    if R == 0:
        break
    elif R >= PS[i][1]:
        ans += int(PS[i][0] * PS[i][1] // 2 * (R // PS[i][1]))
        R = R % PS[i][1]
print(ans)

Q, H, S, D = list(map(int, input().split()))
N = int(eval(input()))
ans = (N // 2) * min(8 * Q, 4 * H, S * 2, D) + (N % 2) * min(4 * Q, 2 * H, S)
print(ans)

-PS = [[Q * 8, 0.25], [H * 4, 0.5], [S * 2, 1], [D, 2]] -PS.sort(key=lambda x: x[0]) -R = N -ans = 0 -for i in range(4): -    if R == 0: -        break -    elif R >= PS[i][1]: -        ans += int(PS[i][0] * PS[i][1] // 2 * (R // PS[i][1])) -        R = R % PS[i][1] +ans = (N // 2) * min(8 * Q, 4 * H, S * 2, D) + (N % 2) * min(4 * Q, 2 * H, S)