Problem:
 Score : 300 points    Problem Statement You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs.
Specifically, a 0.25 -liter bottle costs Q yen, a 0.5 -liter bottle costs H yen, a 1 -liter bottle costs S yen, and a 2 -liter bottle costs D yen.
The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?      Constraints  1 \leq Q, H, S, D \leq 10^8  1 \leq N \leq 10^9  All input values are integers.         Input Input is given from Standard Input in the following format:  Q  H  S  D  N       Output Print the smallest number of yen you have to spend to buy exactly N liters of ice tea.        Sample Input 1 20 30 70 90
3      Sample Output 1 150  Buy one 2 -liter bottle and two 0.5 -liter bottles. You'll get 3 liters for 90 + 30 + 30 = 150 yen.       Sample Input 2 10000 1000 100 10
1      Sample Output 2 100  Even though a 2 -liter bottle costs just 10 yen, you need only 1 liter.
Thus, you have to buy a 1 -liter bottle for 100 yen.       Sample Input 3 10 100 1000 10000
1      Sample Output 3 40  Now it's better to buy four 0.25 -liter bottles for 10 + 10 + 10 + 10 = 40 yen.       Sample Input 4 12345678 87654321 12345678 87654321
123456789      Sample Output 4 1524157763907942

Solution (Python):
a, b, c, d = map(int, input().split())
n = int(input())

A = [4*a, 2*b, c]
t = 0
if min(A) * 2 > d:
    t = n//2 * d
    n = n - (n//2)*2

t += n * min(A)

print(t)

Solution (Python):
Q,H,S,D=map(int,input().split())
N=int(input())

q=Q*8
h=H*4
s=S*2
d=D
if N%2==0:
    ans=(N//2)*min(q,h,s,d)
    print(ans)
else:
    ans=(N//2)*min(q,h,s,d)
    q=Q*4
    h=H*2
    s=S
    ans+=min(q,h,s)
    print(ans)

Solution (Python):
q,h,s,d = map(int,input().split())
n = int(input())
s = min(q*4,h*2,s)
d = min(s*2,d)
print((n//2)*d+(n%2)*s)

Solution (Python):
q,h,s,d = map(int,input().split())
n = int(input())
s = min(q*4,h*2,s)
d = min(s*2,d)
print(s if n==1 else (n//2)*d+(n%2)*s)

Solution (Python):
Q,H,S,D=map(int,input().split(' '))
N = int(input())
l1 = min(4*Q,2*H,S)
l2 = min(2*l1,D)
if N==1:
    print(l1)
elif N%2==0:
    print(N//2*l2)
else:
    print(N//2*l2+l1)

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())

l = min(q*4, h*2, s)
l2 = min(q*8, h*4, s*2, d)
if n % 2 == 0:
    ans = l2 * (n//2)
else:
    ans = l2 * (n//2) + l
print(ans)

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())

q_l, h_l, s_l = q*4, h*2, s
l = min(q_l, h_l, s_l)
q_2l, h_2l, s_2l, d_2l = q*8, h*4, s*2, d
l2 = min(q_2l, h_2l, s_2l, d_2l)

if n % 2 == 0:
    ans = l2 * (n//2)
else:
    ans = l2 * (n//2) + l * 1
print(ans)

Solution (Python):
Q, H, S, D = map(int,input().split())
N = int(input())
W = min(2*Q, H)
T = min(2*W, S)
E = min(2*T, D)
if N%2 == 0:
    ans = E * (N//2)
else:
    ans = E * (N//2) + T
print(ans)

Solution (Python):
import sys
from collections import deque

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

Q, H, S, D = lr()
N = ir()

H = min(Q * 2, H)
S = min(H * 2, S)
if S * 2 <= D:
    print(S * N)
else:
    print((N // 2) * D + (N % 2) * S)

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())
ans = 0
if N % 2 == 0:
    ans = min(4*N*Q, 2*N*H, N*S, N*D//2)
else:
    ans += min(4*(N-1)*Q, 2*(N-1)*H, (N-1)*S, (N-1)*D//2)
    ans += min(4*Q, 2*H, S)

print(ans)

Solution (Python):
q, h, s, d=map(int, input().split())
n=int(input())
p1=min(4*q, 2*h, s)
p2=min(2*p1, d)
print((n//2)*p2+(n%2)*p1)

Solution (Python):
Q, H ,S, D = map(int, input().split())
N = int(input())

tmp = [Q*4, H*2, S]
m = min(tmp)

if N == 1:
    print(m)
else:
    print(min(m*2, D) * (N//2) + m*(N%2))

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())

if n%2 == 0:
    print(min(n*4*q, n*2*h, n*s, n//2*d))
else:
    print(min((n-1)*4*q, (n-1)*2*h, (n-1)*s, (n-1)//2*d) + min(4*q, 2*h, s))

Solution (Python):
q, h, s, d, n = map(int, open(0).read().split())
m = min(q*4, h*2, s)
print(min(n*m, n//2*d + n%2*m))

Solution (Python):
Q,H,S,D = map(int, input().split())
N = int(input())

if N % 2 == 0:
  print(min(Q*N*4,H*N*2,S*N,D*N//2))
else:
  N -= 1
  print(min(Q*N*4,H*N*2,S*N,D*N//2) + min(Q*4,H*2,S))

Solution (Python):
















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

ltl_1 = min(4*Q,2*H,S)
lit_2 = min(2*ltl_1,D)
num1 = N%2
num2 = N//2

ans = num2 * lit_2 + num1 * ltl_1
print(ans)

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())

nQ = 4 * Q
nH = 2 * H
nS = S
nD = D / 2

if nD < min(nQ, nH, nS):
    ans = D * (N // 2) + min(nQ, nH, nS) * (N - (N // 2) * 2)
else:
    ans = min(nQ, nH, nS) * N
print(ans)

Solution (Python):
def myAnswer(Q: int, H: int, S: int, D: int, N: int) -> int:
    H = min(H, Q*2)
    S = min(S, H*2)
    D = min(D, S*2)
    total = 0
    while N != 0:
        if(N < 2):
            total += S
            N -= 1
        else:
            total += (N//2) * D
            N = N % 2
    return total


def modelAnswer():
    tmp = 1


def main():
    Q, H, S, D = map(int, input().split())
    N = int(input())
    print(myAnswer(Q, H, S, D, N))


if __name__ == '__main__':
    main()

Solution (Python):
Q,H,S,D = map(int,input().rstrip().split(' '))
N = int(input())
 
one = min(S,2*H,4*Q)
two = min(D,2*one)
 
ans = two*(N//2)+one*(N%2)
print(ans)

Solution (Python):
q,h,s,d = map(int,input().split())
lis = [1, 2, 4, 8]
score = [q,h,s,d]
n = int(input())
all_s = 4*n

tmp_li = [8*q,4*h,2*s,d]
tmp_2 = tmp_li[:]
tmp_2.sort()

jun = []
for t in tmp_2:
    jun.append(tmp_li.index(t))



ans = 0
for j in jun:
    a = all_s // lis[j]
    b = all_s % lis[j]
    
    all_s -= a*lis[j]
    ans += score[j]*a
print(ans)

Solution (Python):
Q,H,S,D = map(int,input().rstrip().split(' '))
N = int(input())

one = min(S,2*H,4*Q)
two = min(D,2*one)

ans = two*(N//2)+one*(N%2)
print(ans)

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())

ans = n // 2 * min(q * 8, h * 4, s * 2, d)
if n % 2 == 1:
    ans += min(q * 4, h * 2, s)
print(ans)

Solution (Python):
a,b,c,d=map(int, input().split())
n=int(input())
oneltr=min(4*a, 2*b, c, 2*a+b)
twoltr=min(8*a, 4*b, 2*c, d, c+2*b, c+b+2*a,c+4*a,4*a+2*b,b+6*a,3*b+2*a)

if n%2==0 :
               print(twoltr * (n//2))
else :
               print(oneltr+twoltr * ((n-1)//2))

Solution (Python):
Q, H, S, D = map(int, input().split())   
N = int(input())

if N%2==0:
    kijun1 = min(Q*8, H*4, S*2, D)
    print(N//2 * kijun1)
else:
    kijun1 = min(Q*8, H*4, S*2, D)
    kijun2 = min(Q*4, H*2, S)
    print(N//2 * kijun1 + kijun2)

Solution (Python):
q,h,s,d = map(int,input().split())
n = int(input())
ans = 0

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

ans = (n//2)*(min(a*2,d))+(n%2)*a
print(ans)

Solution (Python):
a,b,c,d=map(int,input().split())
n=int(input())

twoval=min(8*a,4*a+2*b,4*b,2*b+c,2*c,d)
oneval=min(4*a,2*b,2*a+b,c)

if n%2==0:
    print(twoval*(n//2))
else:
    print(oneval+twoval*((n-1)//2))

Solution (Python):
q,h,s,d=map(int,input().split())
n=int(input())
List1=[q*4,h*2,s]
List2=[q*8,h*4,s*2,d]
if (n%2==0):
  ans=n*min(List2)//2
  print(ans)
else:
  ans=(n-1)*min(List2)//2
  ans+=min(List1)
  print(ans)

Solution (Python):
Q,H,S,D=map(int,input().split())
o=Q*8;h=H*4;s=S*2;d=D
N=int(input())*100
A=[0]*4;p=0;q=N
 
A=[[25,Q,o],[50,H,h],[100,S,s],[200,D,d]]
A.sort(key=lambda x: x[2])
 

 
i=0
while  q>0:
  if q%A[i][0]==0:
    p=p+(q//A[i][0])*A[i][1]
    q=q-(q//A[i][0])*A[i][0]
    break
  else:
    p=p+(q//A[i][0])*A[i][1]
    q=q-(q//A[i][0])*A[i][0]
    i=i+1
 
print(int(p))

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())
print(min(q * 8, h * 4, s * 2, d) * (n // 2) + min(q * 4, h * 2, s) * (n % 2))

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())

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

print(n // 2 * d + n % 2 * s)

Solution (Python):
if __name__ == "__main__":
    q, h, s, d = map(int, input().split())
    n = int(input())

    
    value = list()
    value.append(q*4)
    value.append(h*2)
    value.append(s)
    value.append(d/2)

    ans = 0
    if min(value) == value[3]:
        if n % 2 == 1:
            ans += n // 2 * d
            ans += min(value[0:3])
        else:
            ans += n // 2 * d
    else:
        ans += min(value) * n

    print(ans)

Solution (Python):
Q, H, S, D = list(map(int, input().split()))
Q *= 8
H *= 4
S *= 2
A = min(Q, H, S, D)
B = int(min(Q, H, S) / 2)
N = int(input())
 
print(int(N//2*A+N%2*B))

Solution (Python):
Q, H, S, D = list(map(int, input().split()))
Q *= 8
H *= 4
S *= 2
A = min(Q, H, S, D)
B = min(Q, H, S) // 2
N = int(input())

print(int(N//2*A+N%2*B))

Solution (Python):
from sys import stdin

q, h, s, d = map(int, stdin.readline().rstrip().split())
n = int(stdin.readline().rstrip())
q *= 4
h *= 2
t = min(q, h, s)
if 2 * t > d:
    print((n // 2) * d + (n % 2) * t)
else:
    print(n * t)

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())


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

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

if n == 1:
    print(y)
else:
    if n % 2 == 0:
        print(x * (n // 2))
    else:
        print(x * (n // 2) + y)

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())

if n % 2 == 0:
    print((n//2)*min(8*q, 4*h, 2*s, d))
else:
    print((n//2)*min(8*q, 4*h, 2*s, d)+min(4*q, 2*h, s))

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
from operator import itemgetter
def main():
    q,h,s,d=map(int,input().split())
    n=int(input())
    weight=[(0.25,q,q/0.25),(0.5,h,h/0.5),(1,s,s),(2,d,d/2)]
    weight.sort(key=itemgetter(2))
    cost=0
    for w in weight:
        kosu=n//w[0]
        cost+=int(w[1]*kosu)
        n-=w[0]*kosu
    print(cost)
if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
from operator import itemgetter
def main():
    q,h,s,d=map(int,input().split())
    n=int(input())
    weight=[(0.25,q,q/0.25),(0.5,h,h/0.5),(1,s,s),(2,d,d/2)]
    weight.sort(key=itemgetter(2))
    cost=0
    for w in weight:
        kosu=n//w[0]
        cost+=int(w[1]*kosu)
        n-=w[0]*kosu
    print(cost)
if __name__=='__main__':
    main()

Solution (Python):
q,h,s,d = map(int,input().split())
n = int(input())
a=min(q*8,h*4,s*2,d)
b=min(q*4,h*2,s)
ans = 0
if n%2==1:
    ans += b
    ans += min(b*(n-1),a*(n//2))
else:
    ans += min(b*n,a*(n//2))
print(ans)

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())
m = min(4*q, 2*h, s)
if n % 2:
    print(min(d * (n//2) + m, m * n))
else:
    print(min(d * (n//2), m * n))

Solution (Python):



import sys
input = sys.stdin.readline

def main():
    P = list(map(int, input().split()))
    N = int(input())
    p = min(P[0]*4, P[1]*2, P[2])
    print(min(N*p, (N//2)*P[3] + (N%2)*p))

if __name__ == '__main__':
    main()

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())

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

Solution (Python):
q, h, s, d = (int(x) for x in input().split())
n = int(input())
l1 = min(4*q, 2*h, s)
l2 = min(8*q, 4*h, 2*s, d)
if n%2 == 0:
  print((n//2) * l2)
else:
  print((n//2) * l2 + l1)

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())

p025 = Q
p05 = min(H, p025 * 2)
p1 = min(S, p05 * 2)
p2 = min(D, p1 * 2)

ans = 0
if N % 2 != 0:
    N -= 1
    ans += p1
ans += (N // 2) * p2

print(ans)

Solution (Python):
q, h, s, d = (int(i) for i in input().split())
n = int(input())
x = min(4*q, 2*h, s)
y = min(2*x, d)
print( (y*(n-n%2)//2) + x*(n%2) )

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())

two_l = min(8*Q, 4*H, 2*S, D)
one_l = min(4*Q, 2*H, S)

ans = (N//2)*two_l + (N%2)*one_l
print(ans)

Solution (Python):
q,h,s,d = map(int,input().split())
n = int(input())
l1 = min([4*q,2*h,s])
ans = min(l1*n,d*(n//2) if n%2 == 0 else d*(n//2)+l1)
print(ans)

Solution (Python):
import heapq
from collections import defaultdict, deque
from math import ceil, factorial
from fractions import gcd
import sys

sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))


Q, H, S, D = mii()
N = ii()

tea = [
    (Q, 0.25),
    (H, 0.5),
    (S, 1),
    (D, 2),
]
tea.sort(key=lambda x: x[0] / x[1])

ans = 0
remaining = N
for i in range(4):
    p, q = tea[i]
    d, m = map(int, divmod(remaining, q))
    if d == 0:
        continue
    ans += d * p
    remaining = m

print(int(ans))

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
q,h,s,d = iim()
n = ii()

if q*8 <= min(4*h,2*s,d):
    print(n*4*q)
elif 4*h <= min(2*s,d):
    print(n*2*h)
elif s*2 <= d:
    print(n*s)
else:
    print(n//2*d + n%2*min(s,2*h,4*q))

Solution (Python):
import decimal
a,b,c,d=map(int,input().split())
n=int(input())
l=[a*4,b*2,c,d/2]
p=min(l)
q=min(l[:3])
print(int(decimal.Decimal(n)*decimal.Decimal(min(l))) if n%2==0 or p==q else int(decimal.Decimal(n-1)*decimal.Decimal(d/2)+q))

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())
S = min(S, 4*Q, 2*H)
D = min(D, 2*S)
print(D*(N//2) if N % 2 == 0 else D*(N//2) + S)

Solution (Python):
q,h,s,d=map(int,input().split())
n=int(input())
h=min(h,q*2)
s=min(s,h*2)
d=min(d,s*2)
print (d*(n//2)+s*(n%2))

Solution (Python):
x = list(map(int, input().split()))
N = int(input())
x[1] = min(x[0] * 2, x[1])
x[2] = min(x[0] * 4, x[1] * 2, x[2])
x[3] = min(x[0] * 8, x[1] * 4, x[2] * 2, x[3])
a = N // 2 * x[3] + (N - 2 * (N // 2)) * x[2]
b = N * x[2]
print(min(a, b))

Solution (Python):
import sys
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())

Q, H, S, D = MAP()
N = INT()

l = [(Decimal(0.25), Q, 0.25/Q), (Decimal(0.5), H, 0.5/H), (1, S, 1/S), (2, D, 2/D)]
l.sort(key=lambda x:x[2], reverse=True)
ans = 0
idx = 0
while N != 0:
	n = N//l[idx][0]
	ans += l[idx][1]*n
	N -= l[idx][0]*n

	idx += 1

print(ans)

Solution (Python):
q,h,s,d = [int(i) for i in input().split()]
n = int(input())

one = min(4*q,2*h,s)
two = min(2*one,d)

print(n // 2 * two + one if n % 2 else n//2 * two)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

Q, H, S, D = MAP()
N = INT()

l = [(Decimal(0.25), Q, 0.25/Q), (Decimal(0.5), H, 0.5/H), (1, S, 1/S), (2, D, 2/D)]
l.sort(key=lambda x:x[2], reverse=True)
ans = 0
idx = 0
while N != 0:
	n = N//l[idx][0]
	ans += l[idx][1]*n
	N -= l[idx][0]*n

	idx += 1

print(ans)

Solution (Python):
q,h,s,d = map(int, input().split())
n = int(input())

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

print((n//2)*min(2*x,d)+(n%2)*x)

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())

cost = N//2

price = min(D*cost, S*2*cost, H*4*cost, Q*8*cost)
if(N%2 == 0):
    print(price)
else:
    price += min(S, 2*H, 4*Q)
    print(price)

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())
a = [4 * q, 2 * h, s]
b = [8 * q, 4 * h, 2 * s, d]
print(min(b) * (n // 2) + min(a) * (n % 2))

Solution (Python):
q,h,s,d=map(int,input().split())
n=int(input())
l=min(q*n*4,h*n*2,s*n,d*n//2)
if l != d*n//2:
    print(l)
else:
    m=min(q*4,h*2,s)
    print(int((d*(n-1)//2)+m) if n%2==1 else int(l))

Solution (Python):
q,h,s,d=map(int,input().split())
n=int(input())
l = min(q*8, h*4, s*2, d)
if l != d or n % 2 == 0:
  print(l*n//2)
else: print(l*(n//2)+min(q*4, h*2, s))

Solution (Python):
q,h,s,d=map(int,input().split())
n=int(input())

l=min(q*n*4,h*n*2,s*n,d*n//2)
if l != d*n//2:
    print(l)
else:
    m=min(q*4,h*2,s)
    print(d*(n//2)+m if n % 2 == 1 else l)

Solution (Python):
q,h,s,d=map(int,input().split())
n=int(input())
 
l=min(q*n*8,h*n*4,s*n*2,d*n)
if l != d*n:
    print (int(l//2))
else:
    m=min(q*4,h*2,s)
    print(int(d*(n-1)//2)+m if n%2==1 else int(l//2))

Solution (Python):
q,h,s,d=map(int,input().split())
n=int(input())
 
l=min(q*n*8,h*n*4,s*n*2,d*n)
if l != d*n:
    print(l//2)
else:
    m=min(q*4,h*2,s)
    print((d*(n-1))//2+m if n%2==1 else l//2)

Solution (Python):
Q,H,S,D = map(int,(input().split()))
N = int(input())
if Q*4 == min(Q*4,H*2,S,D/2):
    print(Q*4*N)
elif H*2 == min(Q*4,H*2,S,D/2):
    print(H*2*N)
elif S == min(Q*4,H*2,S,D/2):
    print(S*N)
else:
    p = 0
    p += D*(N//2)
    if Q*4 == min(Q*4,H*2,S):
        p += Q*4*(N%2)
    elif H*2 == min(Q*4,H*2,S):
        p += H*2*(N%2)
    elif S == min(Q*4,H*2,S):
        p += S*(N%2)
    print(p)

Solution (Python):


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



N=N*4

q=Q*4
h=H*2
s=S
d=D/2
z=[q,h,s,d]
x=[0,0,0,0]

for i in range(4):
    m=max(z)
    j=z.index(m)
    z[j]=0
    x[i]=j
x.reverse()


y=0
for i in x:
    
    if i==0:
        t=N
        N=0
        y+=Q*t
    elif i==1:
        t=N//2
        N-=t*2
        y+=H*t
    elif i==2:
        t=N//4
        N-=4*t
        y+=S*t
    else:
        t=N//8
        N-=8*t
        y+=D*t
print(y)

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())
a = min(4*Q, 2*H, S)
if 2*a <= D:
    print(a*N)
else:
    print(N%2*a+(N//2)*D)

Solution (Python):

def inputlist(): return [int(j) for j in input().split()]


Q,H,S,D = inputlist()
N = int(input())
l = min(4*Q,2*H,S)
l2 = min(2*l,D)
d2 = N//2
d1 = (N-d2*2)
print(d2*l2 + d1*l)

Solution (Python):
q,h,s,d = map(int,input().split())
n = int(input())
h = min(h, 2*q)
s = min(s, 2*h)
d = min(d, 2*s)
res = d*(n//2)
res += s if n%2!=0 else 0
print(res)

Solution (Python):
Q,H,S,D = map(int,input().split())
N = int(input())
N *= 100
H = min(H,2*Q)
S = min(S,2*H)
D = min(D,2*S)
ans = 0
if N%200 != N:
  ans += (N//200)*D
  N %= 200
if N%100 != N:
  ans += (N//100)*S
  N %= 100
if N%50 != 50:
  ans += (N//50)*H
  N %= 50
if N%25 != N:
  ans += (N//25)*Q
  N %= 25
if N == 0:
  print(ans)

Solution (Python):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') 
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(sys.stdin.readline()) 
def ifn(): return float(sys.stdin.readline()) 
def isn(): return sys.stdin.readline().split() 
def imn(): return map(int, sys.stdin.readline().split()) 
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) 
def fmn(): return map(float, sys.stdin.readline().split()) 
def iln(): return list(map(int, sys.stdin.readline().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, sys.stdin.readline().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

Q,H,S,D = imn()
N = iin()

min1L = min(Q*4, H*2, S)
min2L = min(min1L*2, D)

ans = N//2*min2L
if N % 2 == 1: ans += min1L
print(ans)

Solution (Python):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') 
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(sys.stdin.readline()) 
def ifn(): return float(sys.stdin.readline()) 
def isn(): return sys.stdin.readline().split() 
def imn(): return map(int, sys.stdin.readline().split()) 
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) 
def fmn(): return map(float, sys.stdin.readline().split()) 
def iln(): return list(map(int, sys.stdin.readline().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, sys.stdin.readline().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

Q,H,S,D = imn()
N = iin()

min1L = min(Q*4, H*2, S)
min2L = min(min1L*2, D)

if N % 2 == 1:
    print(N//2*min2L + min1L)
else:
    print(N//2*min2L)

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())
L = [S,H*2,Q*4]
if min(L)*2 < D:
    print(min(L)*N)
else:
    if N % 2 == 0:
        print(D*(N//2))
    else:
        print(D*(N//2)+min(L))

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())
Q *= 4
H *= 2
ans = 0
if N & 1:
    ans += min(Q, H, S)
ans += min(2*Q, 2*H, 2*S, D)*(N//2)
print(ans)

Solution (Python):
Q,H,S,D = map(int,input().split())
N = int(input())
h = min(2*Q,H)
s = min(2*h,S)
d = min(2*s,D)
print((N//2)*d + (N%2)*s)

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())
print((n // 2) * min(8 * q, 4 * h, 2 * s, d) + (n % 2) * min(4 * q, 2 * h, s))

Solution (Python):
Q, H, S,D = map(int, input().split())
N = int(input())


N *= 4
cnt = 0

if D <= 2 * S and D <= 4*H and D <= 8*Q:
    cnt += N // 8 *  (D)
    N %= 8


if S <= 2 * H and S <= 4*Q:
    cnt += N // 4 * (S)
    N %= 4


if H <= 2 * Q :
    cnt += N // 2 * (H)
    N %= 2


cnt += N * (Q)

print(cnt)

Solution (Python):
p = list(map(int, input().split()))
n = int(input())

l = [min(p[0] * 4, p[1] * 2, p[0] * 2 + p[1], p[2]), p[3]]
ppl = [l[0], l[1] / 2]

if (ppl[0] <= ppl[1]):
    print(n * l[0])
else:
    print((n//2)*l[1] + (n % 2) * l[0])

Solution (Python):
q,h,s,d = map(int, input().split())
n = int(input()) * 100

h = min(h,q*2)
s = min(s,h*2)
d = min(d,s*2)
ans = 0
count = 0
count = n//200
ans += count * d
n -= count*200

count = n//100
ans += count * s
n -= count*100

count = n//50
ans += count * h
n -= count*50

count = n//25
ans += count * q
n -= count*25
print(ans)

Solution (Python):

import sys


def solve(Q: int, H: int, S: int, D: int, N: int):
    x = min(4*Q,2*H,S)
    y = D

    if x<=y/2:
        print(N*x)
    else:
        if N&1:
            print(N//2*y+x)
        else:
            print(N//2*y)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    Q = int(next(tokens))  
    H = int(next(tokens))  
    S = int(next(tokens))  
    D = int(next(tokens))  
    N = int(next(tokens))  
    solve(Q, H, S, D, N)

if __name__ == '__main__':
    main()

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())


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

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

ans = (n // 2) * cost2
if n % 2 == 1:
  ans += cost1
print(ans)

Solution (Python):
import math

q, h, s, d = map(int, input().split())
n = int(input())*100

qq = [q, q, 25]
hh = [h/2, h, 50]
ss = [s/4, s, 100]
dd = [d/8, d, 200]
qhsd = [qq, hh, ss, dd]
qhsd.sort()

ans = 0
for i in range(4):
    num = n//qhsd[i][2]
    n -= num*qhsd[i][2]
    ans += num*qhsd[i][1]
print(ans)

Solution (Python):
a,b,c,d=map(int,input().split())
a=min(4*a,2*b,c)
N=int(input())
if 2*a<=d:
  print(N*a)
else:
  if N%2==0:
    print(N//2*d)
  else:
    print(N//2*d+a)

Solution (Python):
def main():
    q, h, s, d = map(int, input().split())
    target = int(input())
    h = min(2 * q, h)
    s = min(2 * h, s)
    d = min(2 * s, d)
    answer = target // 2 * d + (target % 2) * s
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
Q,H,S,D = map(int,input().split())
N=int(input())
A=[]

A.append(4*Q)
A.append(2*H)
A.append(S)
A.append(D/2)

if min(A)==A[0]:
  print(N*A[0])
elif min(A)==A[1]:
  print(N*A[1])
elif min(A)==A[2]:
  print(N*A[2])
else:
  a = N//2
  p = a*D
  if a*2!=N:
    if A[0]<=A[1] and A[0]<=A[2]:
      p += A[0]
    elif A[1]<=A[2] and A[1]<=A[0]:
      p += A[1]
    else:
      p += A[2]
  print(p)

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())

ans = (N // 2) * min(Q * 8, H * 4, S * 2, D)
if N % 2 == 0:
    print(ans)
else:
    ans += min(Q * 4, H * 2, S)
    print(ans)

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())
A = [Q * 8, H * 4, S * 2, D]
B = [Q * 4, H * 2, S]
Ans = 0

cnt = N // 2
N = N % 2
Ans = Ans + min(A) * cnt
Ans = Ans + min(B) * N
print(Ans)

Solution (Python):
q,h,s,d=map(int,input().split())
n=int(input())
h=min(h,q*2)
s=min(s,h*2)
d=min(d,s*2)
print((n//2)*d + (n%2)*s)

Solution (Python):
q,h,s,d = map(int, input().split())
n = int(input())

ans = 0

print(min(q * 8, h * 4, s * 2, d) * (n // 2)+min(q * 4, h * 2, s) *(n%2==1))

Solution (Python):
Q,H,S,D = map(int, input().split())
N = int(input())

H = min(H, Q * 2)
S = min(S, H * 2)
D = min(D, S * 2)



ans = (N // 2) * D + (N - (N // 2) * 2) * S
print(ans)

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())

rate = {"Q": 4 * Q, "H": 2 * H, "S": S, "D": 1 / 2 * D}
price = 0
score_sorted = sorted(rate.items(), key=lambda x: x[1])
for x in score_sorted:
    if x[0] == "D" and N >= 2:
        div, mod = divmod(N, 2)
        N = mod
        price = D * div
    elif x[0] == "S":
        price += N * S
        break
    elif x[0] == "H":
        price += N * H * 2
        break
    elif x[0] == "Q":
        price += N * Q * 4
        break
    if N == 0:
        break
print(price)

Solution (Python):
Q,H,S,D=map(int,input().split())
N=int(input())
ans=min(4*N*Q,2*N*H,N*S,N//2*D)
if ans==N//2*D and N%2==1:
    ans+=min(4*Q,2*H,S)
    ans=min(ans,4*N*Q,2*N*H,N*S)
print(ans)

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())
h = min(q*2, h)
s = min(h*2, s)
if 2*s <= d:
  print(s*n)
else:
  if n%2==0:
    print(d*(n//2))
  else:
    print(d*(n//2)+s)

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())

l2 = [q*8, h*4, s*2, d]
l1 = [q*4, h*2, s]

ans = (n//2) * min(l2) + (n%2) * min(l1)
print(ans)

Solution (Python):
Q,H,S,D = map(int,input().split())
N = int(input())

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

Solution (Python):
ans_list = list(map(int, input().split()))
N = int(input())
ans_list[1] = min(ans_list[0]*2, ans_list[1])
ans_list[2] = min(ans_list[1]*2, ans_list[2])
if ans_list[2]*2<=ans_list[3]:
    print(N*ans_list[2])
else:
    print(ans_list[3]*(N//2)) if N%2==0 else print(ans_list[3]*(N//2)+ans_list[2])

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())
s_ = min(q*4, h*2, s)
d_ = min(q*8, h*4, s*2, d)
print(min(s_*n, d_*(n//2)+(n%2)*s_))

Solution (Python):
q,h,s,d=list(map(int, input().split()))
x=int(input())

q=q*4
h=h*2

if q<s:
	s=q
if h<s:
	s=h

if s*2<=d:
	print(x*s)
else:
	if x % 2 == 0:
		print((x*d)//2)
	else:
		print(((x//2)*d)+s)

Solution (Python):
q,h,s,d = map(int,input().split())
n = int(input())
h = min(q*2,h)
s = min(h*2,s)

if 2*s <= d:
    print(n*s)
else:
    print(n//2*d+(n%2)*s)

Solution (Python):
def main():
    q, h, s, d = map(int, input().split())
    n = int(input())
    x = min(4*q, 2*h, s)
    y = min(2*x, d)
    ans = n//2*y
    if n%2 == 1:
        ans += x
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
q,h,s,d = map(int,input().split())
n=int(input())

res = 0
ll=min(q*8,h*4,s*2,d)
l=min(q*4,h*2,s)
if n%2== 0:
    print(ll*(n//2))
else:
    print(ll*(n//2)+l)

Solution (Python):
q, h, s, d=map(int, input().split())
n=int(input())

x1=min(4*q, 2*h, s)
x2=min(2*x1, d)
print((n//2)*x2+(n%2)*x1)

Solution (Python):
import sys
import math
input = sys.stdin.readline

q, h, s, d = map(int, input().split())
n = int(input())
ans = 0

if n >= 2:
  ans += min(8 * q, 4 * h, 2 * s, d) * math.floor(n / 2)

if n % 2 == 1:
  ans += min(4 * q, 2 * h, s)
  
print(ans)

Solution (Python):
Q, H, S, D = map(int, input().split())
N = int(input())

A = min(Q*4, H*2, S)
if N % 2 == 0:
    print(min(A*N, D*N//2))
else:
    if N == 1:
        print(A)
    else:
        print(min(A*N, D*(N//2)+A))

Solution (Python):
q, h, s, d = map(int, input().split())
n = int(input())
h = min(q*2, h)
s = min(h*2, s)
d = min(s*2, d)
if n % 2 == 0:
  print(min(s*n, d*(n//2)))
else:
  print(min(s*n, d*(n//2)+s))

Solution (Python):
a, b, c, d = list(map(int, input().split()))
n = int(input())


min_for_one = min(a*4, b*2, c)

min_for_two = min(a*8, b*4, c*2, d)

if n % 2 == 1:
    print((n //2)* min_for_two + min_for_one)
else:
    print(n // 2 * min_for_two)

Solution (Python):
q,h,s,d=map(int,input().split())
n=int(input())
qhs=min(q*4,h*2,s)
if qhs*2<=d:
    print(qhs*n)
else:
    print(d*(n//2)+qhs*(n%2))

Solution (Python):


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

x=min(q*8,h*4,s*2,d)
y=min(q*4,h*2,s)
if N % 2 == 0:
    ans = x * (N//2)
else:
    ans = x * (N // 2)
    ans += y

print(ans)

Solution (Python):
Q,H,S,D=map(int,input().split())
N=int(input())
usage=[]
slist=[4*Q,2*H,S]
slist.sort()
s=slist[0]  
dlist=[8*Q,4*H,2*s,D]
dlist.sort()
d=dlist[0]  

if N%2==0:
    print(d*(N//2))
else:
    print(d*(N//2)+s)

Solution (Python):
Q, H, S, D = list(map(int, input().split()))
N = int(input())

t = min(4*Q, 2*H, S)
if D < 2 * t:
    if N % 2 == 0:
        ans = (N // 2) * D
    else:
        ans = (N // 2) * D + t
else:
    ans = N * t

print(ans)

Solution (Python):
Q, H, S, D = list(map(int, input().split()))
N = int(input())

ans1 = 4 * Q * N
ans2 = 2 * H * N
ans3 = S * N

if N < 2:
    ans4 = float('INF')
elif N % 2 == 0:
    ans4 = (N // 2) * D
else:
    t = (N // 2) * D
    ans4 = t + min(4 * Q, 2 * H, 1 * S)


ans = min(ans1, ans2, ans3, ans4)
print(ans)

Solution (Python):
q, h, s, d = map(int,input().split())
n = int(input())
v1 = min(q*4, h*2, s* 1)
v2 = min(v1 * 2, d)
print(n // 2 * v2 + n%2 * v1)