qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import math
q,h,s,d = map(int,input().split())
n = int(input())
value = [0]*4
value[0] = q*4
value[1] = h*2
value[2] = s
value[3] = d/2
dum = min(value)
ind = value.index(dum)
if ind == 0:
    print(value[0]*n)
elif ind == 1:
    print(value[1]*n)
elif ind == 2:
    print(value[2]*n)
else:
    if n == 1:
        value.sort()
        print(value[1])
    elif n%2 == 0:
        print(math.floor(d*n//2))
    else:
        dum1 = (n//2)*d
        print(dum1)
        print(dum1)
        value.sort()
        print(math.floor(value[1]+dum1))

Fixed code:
import math
q,h,s,d = map(int,input().split())
n = int(input())
value = [0]*4
value[0] = q*4
value[1] = h*2
value[2] = s
value[3] = d/2
dum = min(value)
ind = value.index(dum)
if ind == 0:
    print(value[0]*n)
elif ind == 1:
    print(value[1]*n)
elif ind == 2:
    print(value[2]*n)
else:
    if n == 1:
        value.sort()
        print(value[1])
    elif n%2 == 0:
        print(math.floor(d*n//2))
    else:
        dum1 = (n//2)*d
        value.sort()
        print(math.floor(value[1]+dum1))
Buggy code:
# A - Ice Tea Store

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

for_1L = min(4*Q, 2*T, S)
for_2L = min(for_1L, D)

print((N//2)*for_2L + (N%2)*for_1L)

Fixed code:
# A - Ice Tea Store

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

for_1L = min(4*Q, 2*T, S)
for_2L = min(2*for_1L, D)

print((N//2)*for_2L + (N%2)*for_1L)
Buggy code:
Q, H, S, D = map(int, input().split())
N = int(input())

c_05 = min(2*Q, H)
c_1 = min(2*c_05, S)

if c_1 <= D:
    print(c_1 * N)
else:
    if N % 2 == 0:
        print(D * (N//2))
    else:
        print(D * (N//2) + c_1)

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

c_05 = min(2*Q, H)
c_1 = min(2*c_05, S)

if 2*c_1 <= D:
    print(c_1 * N)
else:
    if N % 2 == 0:
        print(D * (N//2))
    else:
        print(D * (N//2) + c_1)
Buggy code:
q, h, s, d = map(int, input().split())
n = int(input())
q_cp = q*8
h_cp = h*4
s_cp = s*2
d_cp = d
ans = 0
if min(q_cp, h_cp, s_cp, d_cp) == q_cp:
    ans += n//2*4*q
elif min(q_cp, h_cp, s_cp, d_cp) == h_cp:
    ans += n//52*2*h
elif min(q_cp, h_cp, s_cp, d_cp) == s_cp:
    ans += n//2*s
else:
    ans += n//2*d
    amari = n%2
    if min(q_cp, h_cp, s_cp) == q_cp:
        ans += amari/0.25*q
    elif min(q_cp, h_cp, s_cp) == h_cp:
        ans += amari/0.5*h
    elif min(q_cp, h_cp, s_cp) == s_cp:
        ans += amari*s

print(int(ans))


Fixed code:
q, h, s, d = map(int, input().split())
n = int(input())
q_cp = q*8
h_cp = h*4
s_cp = s*2
d_cp = d
ans = 0
if min(q_cp,h_cp,s_cp,d_cp)==q_cp:
    ans+=n*q*4
elif min(q_cp,h_cp,s_cp,d_cp)==h_cp:
    ans+=n*h*2
elif min(q_cp,h_cp,s_cp,d_cp)==s_cp:
    ans+=n*s
else:
    ans += n//2*d
    amari = n%2
    if min(q_cp, h_cp, s_cp) == q_cp:
        ans += amari*q*4
    elif min(q_cp, h_cp, s_cp) == h_cp:
        ans += amari*h*2
    elif min(q_cp, h_cp, s_cp) == s_cp:
        ans += amari*s
print(int(ans))
Buggy code:
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(n//2*twoltr)
else :
                    print(oneltr+(n-1)//2*twoltr)


Fixed code:
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))
Buggy code:
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(w[1],kosu)
    print(cost)
if __name__=='__main__':
    main()

Fixed code:
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()
Buggy code:
q,h,s,d = map(int,input().split())
n = int(input())
a= min([q*4,h*2,s])
b= min([a*2,d])
print(a+b*n//2)

Fixed code:
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))
Buggy code:
q, h, s, d = map(int, input().split())
n = int(input())

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


Fixed code:
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))
Buggy code:
Q, H, S, D = map(int, input().split())
N = int(input())

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

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

smin = min(4 * Q, 2 * H, S)
if D < 2 * smin:
    print((N // 2) * D + (N % 2) * smin)
else:
    print(N * smin)
Buggy code:
# coding: utf-8
# Your code here!
cost=list(map(int,input().split()))

for i in range(4):
    cost[i]/=2**(i-2)

N=int(input())

if min(cost)==cost[3]:
    print(((N//2*2)*cost[3]+(N%2)*min(cost[:3])))
else:
    print((min(cost)*N))

Fixed code:
# coding: utf-8
# Your code here!
cost=list(map(int,input().split()))

for i in range(4):
    cost[i]/=2**(i-2)
    if i!=3:
        cost[i]=int(cost[i])
    
N=int(input())

if min(cost)==cost[3]:
    temp=int(cost[3]*2)
    print(((N//2)*temp+(N%2)*min(cost[:3])))
else:
    print((min(cost)*N))
Buggy code:
import sys
def input():
    return sys.stdin.readline()[:-1]
q,h,s,d=map(int,input().split())
n=int(input())
li=[[0.25,q],[0.5,h],[1,s]]
li.sort(key=lambda x: x[1]/x[0])
li=[[1,int(li[0][1])],[2,d]]
# print(li)
ans=0
now=0
for i in range(2):
    ko=(n-now)//li[i][0]
    ans+=ko*li[i][1]
    now+=ko*li[i][0]
    now=int(now)
    # print(ans,now)
print(int(ans))

Fixed code:
import sys
def input():
    return sys.stdin.readline()[:-1]
q,h,s,d=map(int,input().split())
n=int(input())
li=[[0.25,q],[0.5,h],[1,s]]
li.sort(key=lambda x: x[1]/x[0])
li=[[1,int(li[0][1]/li[0][0])],[2,d]]
li.sort(key=lambda x: x[1]/x[0])
# print(li)
ans=0
now=0
for i in range(2):
    ko=(n-now)//li[i][0]
    ans+=ko*li[i][1]
    now+=ko*li[i][0]
    now=int(now)
    # print(ans,now)
print(int(ans))
Buggy code:
# coding: utf-8
# Your code here!
Q,H,S,D=map(int,input().split())
N=int(input())
temp=min(4*Q,2*H,S,D/2)

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

    



Fixed code:
# coding: utf-8
# Your code here!
Q,H,S,D=map(int,input().split())
N=int(input())
temp=min(4*Q,2*H,S,D/2)

if temp!=D/2:
    print(N*temp)
else:
    if N%2==1:
        print(N//2*D+min(4*Q,2*H,S))
    else:
        print(N//2*D)
Buggy code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    q, h, s, d = LI()
    n = II()
    q4 = q * 4
    h2 = h * 2
    l1 = min(q4, h2, s)
    l2 = min(l1 * 2, d)
    print((n >> 1) * l2 + (n & 1 * l1))
    
    return


#main
if __name__ == '__main__':
    solve()


Fixed code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    q, h, s, d = LI()
    n = II()
    q4 = q * 4
    h2 = h * 2
    l1 = min(q4, h2, s)
    l2 = min(l1 * 2, d)
    print((n >> 1) * l2 + (n & 1) * l1)
    
    return


#main
if __name__ == '__main__':
    solve()
Buggy code:
import sys
input = sys.stdin.readline

Q,H,S,D = map(int, input().split())
H = min(H, 2*Q)
S = min(S, 2*H)

N=int(input())
answer = 0
if N&1:
  answer +=5
D = min(D, 2*S)
answer += (N//2)*D

Fixed code:
import sys
input = sys.stdin.readline

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

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

N = int(input())
answer = 0

if N&1:
  answer += S

answer += (N//2)*D
print(answer)
Buggy code:
ps = []
l = 8
for p in map(int,input().split()):
  ps.append([p*l, p, l])
  l //= 2
ps.sort()

n = int(input())
ans = 0
for unitp, p, l in ps:
  num = n//l
  ans += num*p
  n -= num*l

print(int(ans))

Fixed code:
ps = []
l = 0.25
for p in map(int,input().split()):
  ps.append([p/l, l, p])
  l *= 2
ps.sort()

n = int(input())
ans = 0
for unitp, l, p in ps:
  num = int(n//l)
  ans += num*p
  n -= int(num*l)
  
print(ans)
Buggy code:
a,b,c,d=map(int,input().split())
n=int(input())
if n == 1:
  print(min(a*4,b*2,c))
elif n%2 == 0:
  print(min(a*4*n,b*2*n,c*n,d*n//2))
else:
  print(min(a*4*n,b*2*n,c*n,d*n//2+min(a*4,b*2,c)))

Fixed code:
a,b,c,d=map(int,input().split())
n=int(input())
if a*4==min(a*4,b*2,c,d//2):
    print(n*a*4)
elif b*2==min(a*4,b*2,c,d//2):
    print(n*b*2)
elif c==min(a*4,b*2,c,d//2):
    print(n*c)
else:
    if n==1:
        ans=d*(n//2)
        if a*4==min(a*4,b*2,c):
            ans+=a*4
        elif b*2==min(a*4,b*2,c):
            ans+=b*2
        elif c==min(a*4,b*2,c):
            ans+=c
        print(ans)
    elif n%2==0:
        print((n*d)//2)
    else:
        ans=d*(n//2)
        if a*4==min(a*4,b*2,c):
            ans+=a*4
        elif b*2==min(a*4,b*2,c):
            ans+=b*2
        elif c==min(a*4,b*2,c):
            ans+=c
        print(ans)
Buggy code:
q, h, s, d = map(int, input().split())
n = int(input())

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

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


Fixed code:
q, h, s, d = map(int, input().split())
n = int(input())

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

ans = n // 2 * two + n % 2 * one
print(ans)
Buggy code:
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:
  m = min(4*Q,2*H,S)
  if 2*m <= D:
    print(m*N)
  else:
    print((D/2)*N+m)

Fixed code:
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:
  m = min(4*Q,2*H,S)
  if 2*m <= D:
    print(m*N)
  else:
    print(int(D*(N//2)+m))
Buggy code:
Q, H, S, D = map(int, input().split())
N = int(input())

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

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

most_bargain = min(8 * Q, 4 * H, 2 * S, D)
if most_bargain != D:
    print((most_bargain // 2) * N)
else:
    if N % 2 == 0:
        print((N // 2) * D)
    else:
        print((N // 2) * D + min(4 * Q, 2 * H, S))
Buggy code:
# 2019/08/08

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

q=Q*4
h=H*2
s=S
d=D/2
ls=sorted([q,h,s,d])
if ls[0]==d and ls[1]!=d:
    if n%2:
        ans=D*(n//2)
    else:
        ans=D*(n//2)+ls[1]

else:
    ans=int(ls[0]*n)
print(ans)

Fixed code:
# 2019/08/08

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

q=Q*4
h=H*2
s=S
d=D/2
ls=sorted([q,h,s,d])
if ls[0]==d and ls[1]!=d:
    if n%2:
        ans=D*(n//2)+ls[1]
    else:
        ans=D*(n//2)

else:
    ans=int(ls[0]*n)
print(ans)
Buggy code:
q,h,s,d=map(int,input().split())
n=int(input())
cperl=[q*4,h*2,s,d//2]
if n%2==0:
  print(n*min(cperl))
else:
  if min(cperl)==cperl[3]:
    print(cperl[3]*(n//2)+min(cperl[:3]))
  else:
    print(n*min(cperl))

Fixed code:
q,h,s,d=map(int,input().split())
n=int(input())
cperl=[q*8,h*4,s*2,d]
if n%2==0:
  print(int((n//2)*min(cperl)))
else:
  if min(cperl)==cperl[3]:
    print(int(cperl[3]*(n//2)+min(cperl[:3])//2))
  else:
    print(int(n*(min(cperl)//2)))
Buggy code:
Q, H, S, D = map(int, input().split())
N = int(input())
q = 8*Q
h = 4*H
s = 2*S
if N%2 == 0:
    print(min(q,h,s,S)*(N//2))
else:
    print(min(q,h,s,S)*(N//2) + min(4*Q,2*H,S,D))

Fixed code:
Q, H, S, D = map(int, input().split())
N = int(input())
q = 8*Q
h = 4*H
s = 2*S
if N%2 == 0:
    print(min(q,h,s,D)*(N//2))
else:
    print(min(q,h,s,D)*(N//2) + min(4*Q,2*H,S))
Buggy code:
q, h, s, d = map(int, input().split())
n = int(input())

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

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




Fixed code:
q,h,s,d=map(int,input().split())
n=int(input())
s=min(s,min(4*q,2*h))
print(s*n if s<=d//2 else d*(n//2)+s*(n%2))
Buggy code:
Q,H,S,D = map(int,input().split())
N = int(input())  

C = min(4*Q,2*H,S)
if 2*C<=S:
    print(N*C)
elif N%2==0:
    print(N*S//2)
else:
    print((N//2)*S+C)


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

C = min(4*Q,2*H,S)
if 2*C<=D:
    print(N*C)
elif N%2==0:
    print(N*D//2)  
else:
    print((N//2)*D+C)
Buggy code:
q,h,s,d = map(int,input().split())
r = [q,h,s,d]
n = int(input())*4
l = [q,h/2,s/4,d/8]
v = [1,2,4,8]
cost = 0
while n:
  now = l2.index(min(l))
  cost += n//v[now] * r[now]
  n %= v[now]
  v.pop(now)
  r.pop(now)
  l.pop(now)
print(cost)


Fixed code:
q,h,s,d = map(int,input().split())
r = [q,h,s,d]
n = int(input())*4
l = [q,h/2,s/4,d/8]
v = [1,2,4,8]
cost = 0
while n:
  now = l.index(min(l))
  cost += n//v[now] * r[now]
  n %= v[now]
  v.pop(now)
  r.pop(now)
  l.pop(now)
print(cost)
Buggy code:
q, h, s, d = list(map(int, input().split()))
n = int(input())
t = min(4*q, 2*h, s)
if n%2==0:
  ans = min(n*t, n*(d/2))
else:
  ans = min((n-1)*t, (n-1)*(d/2))+t
print(ans)

Fixed code:
q, h, s, d = map(int, input().split())
n = int(input())

mi = min(q*4, h*2, s)
if n % 2 == 0:
    mi = min(mi*2, d)
    print(n//2 * mi)
else:
    ans = 0
    ans += mi
    n -= 1
    mi = min(mi*2, d)
    print(n//2 * mi + ans)
Buggy code:
# -*- coding: utf-8 -*-


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

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

    print(ans)


if __name__ == '__main__':
    main()


Fixed code:
# -*- coding: utf-8 -*-


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

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

    print(int(ans))


if __name__ == '__main__':
    main()
Buggy code:
Q, H, S, D = map(int, input().split())  # 0.25, 0.5, 1, 2
N = int(input())
H = min(H, 2 * Q)   # 0.5
S = min(S, 2 * H)   # 1
if 2 * S <= D:
    print(S * N)
else:
    if N % 2 == 0:
        print(D * N // 2)
    else:
        print(D * N // 2 + S)

Fixed code:
Q, H, S, D = map(int, input().split())  # 0.25, 0.5, 1, 2
H = min(H, 2 * Q)   # 0.5
S = min(S, 2 * H)   # 1
N = int(input())
if 2 * S <= D:
    print(S * N)
else:
    if N % 2 == 0:
        print(D * N // 2)
    else:
        print(D * (N // 2) + S)
Buggy code:
Q, H, S, D = map(int, input().split())
N = int(input())

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

Fixed code:
Q, H, S, D = map(int, input().split())
N = int(input())
H = min(2*Q, H)
S = min(2*H, S)

if 2*S <= D:
    print(S * N)
else:
    print(D * (N//2) + (N % 2) * S)
Buggy code:
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)

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

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

print(D*(N//2) + S*(N%2))
Buggy code:
a,b,c,d = map(int,input().split())
n = int(input())
if min(a * 8,b * 4,c * 2,d) == a * 8:
  print(n * 4 * a)
elif min(a * 8,b * 4,c * 2,d) == b * 4:
  print(n * 2 * b)
elif min(a * 8,b * 4,c * 2,d) == c * 2:
  print(n * c)
else:
  print((n//2) * d + (n % 2) * min(a * 4,b * 2,c,d))

Fixed code:
a,b,c,d = map(int,input().split())
n = int(input())
if min(a * 8,b * 4,c * 2,d) == a * 8:
  print(n * 4 * a)
elif min(a * 8,b * 4,c * 2,d) == b * 4:
  print(n * 2 * b)
elif min(a * 8,b * 4,c * 2,d) == c * 2:
  print(n * c)
else:
  print((n//2) * d + (n % 2) * min(a * 4,b * 2,c))
Buggy code:
money = list(map(int, input().split()))
if money[0] * 2 < money[1]:
    money[0] *= 4
    del money[1]
else:
    money[1] * 2
    del money[0]
if money[0] < money[1]:
    del money[1]
else:
    del money[0]
if money[0] * 2 < money[1]:
    money[1] = money[0] * 2
N = int(input())
print(N // 2 * money[1] + N % 2 * money[0])


Fixed code:
money = list(map(int, input().split()))
if money[0] * 2 < money[1]:
    money[0] *= 4
    del money[1]
else:
    money[1] *= 2
    del money[0]
if money[0] < money[1]:
    del money[1]
else:
    del money[0]
if money[0] * 2 < money[1]:
    money[1] = money[0] * 2
N = int(input())
print(N // 2 * money[1] + N % 2 * money[0])
Buggy code:
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)
N = int(input())

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

Fixed code:
Q, H, S, D = list(map(int, input().split()))
N = int(input())
print(N//2*min(Q*8, H*4, S*2, D)+(N%2)*min(Q*4, H*2, S))
Buggy code:
Q, H, S, D=map(int,input().split())
N=int(input())
Q_1liter=4*Q
H_1liter=2*H
S_1liter=S
min_QHS=min(Q_1liter,H_1liter,S_1liter)
min_QHS2=min(min_QHS*2,D)
if N%2==0:
    output=min_QHS2*(N/2)
    print(output)
else:
    output=((N-1)/2)*min_QHS2+min_QHS
    print(output)

Fixed code:
Q, H, S, D=map(int,input().split())
N=int(input())
Q_1liter=4*Q
H_1liter=2*H
S_1liter=S
min_QHS=min(Q_1liter,H_1liter,S_1liter)
min_QHS2=min(min_QHS*2,D)
if N%2==0:
    output=min_QHS2*(N//2)
    print(int(output))
else:
    output=((N//2)*min_QHS2+min_QHS)
    print(int(output))
Buggy code:
q,h,s,d=map(int,input().split())
n=int(input())
a=min(q*4,h*2,s)
b=min(q*8,h*4,s*2,d)
print(min(a*n,a*(n%2)+b*(n//2))

Fixed code:
q,h,s,d = map(int,input().split())
n = int(input())
a= min(q*4,h*2,s)
b= min(a*2,d)
print(a*(n%2)+b*(n//2))
Buggy code:
    Q,H,S,D = list(map(int,input().split()))
    N = int(input())
    
    if N%2 == 0:
    	A = (N/2) * min(Q*8,H*4,S*2,D)
    else:
    	if: N == 1:
    		A = min(Q*4,H*2,S)
        else:
	    	A = min(Q*4,H*2,S) + ((N-1)/2) * min(Q*8,H*4,S*2,D)
	
    print(int(A))

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

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

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

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

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

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

print(ans)
Buggy code:
b=list(map(int,input().split()))
c = int(input())
ans = 0
r = min([b[0]*4, b[1]*2, b[2]])
r2 = min([r*2, b[3]])
#if c % 2 == 1:
#    ans += r
#   c -= 1
#ans += r2 * (c / 2)
#print(int(ans))

if c%2==1:
	print(((c-1)/2)*r2+r)
else :
	print((c/2)*r2)


Fixed code:
b=list(map(int,input().split()))
c = int(input())
ans = 0
r = min([b[0]*4, b[1]*2, b[2]])
r2 = min([b[0]*8,b[1]*4,b[2]*2, b[3]])
#if c % 2 == 1:
#    ans += r
#   c -= 1
#ans += r2 * (c / 2)
#print(int(ans))

if c%2==1:
	print(((c-1)//2)*r2+r)
else :
	print((c//2)*r2)
Buggy code:
def main():
    rt = 0
    Q,H,S,D = map(int,input())
    N = float(input())
    count_1 = N//2
    count_2 = (N-count_1)//1
    count_3 = (N-count_1-count_2)*100//50
    count_4 = (((N-count_1-count_2)*100)-50*count_3)//25
    if count_1:
       rt+=count_1*min(2*S,D,4*H,8*Q)
    if count_2:
        rt+=count_2*min(S,2*H,4*Q)
    if count_3:
        rt+=min(2*H,Q)*count_3
    if count_4:
        rt+=Q*count_4
    print(rt)

if __name__=="__main__":
    main()

Fixed code:
def main():
    rt = 0
    Q,H,S,D = map(int,input().split(" "))
    N = float(input())
    count_1 = N//2
    count_2 = (N-count_1*2)//1
    count_3 = (N-count_1*2-count_2)*100//50
    count_4 = (((N-count_1*2-count_2)*100)-50*count_3)//25
    if count_1:
        rt+=int(count_1)*min(2*S,D,4*H,8*Q)
    if count_2:
        rt+=int(count_2)*min(S,2*H,4*Q)
    if count_3:
        rt+=min(H,2*Q)*int(count_3)
    if count_4:
        rt+=Q*int(count_4)
    print(int(rt))

if __name__=="__main__":
    main()
Buggy code:
q,h,s,d = map(int,input().split())
n = int(input())
a = min(q*4,h*2,s)
if n % 2 == 0:
  print(min(n/(a*2),n/d))
else:
  print(min(n/(a*2)+d),n/d)
  
        

Fixed code:
q,h,s,d=map(int,input().split())
n=int(input())
a=min(8*q,4*h,2*s,d)
b=min(4*q,2*h,s)
if n%2==0:
    print((n//2)*a)
else:
    print(((n//2)*a)+b)
Buggy code:
q, h, s, d = map(int, input().split())
n = int(input())

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

if n % 2 == 0:
    print(min(x, d // 2) * n)
elif 2 * x < d:
    print(x * n)
else:
    print(d * (n // 2) + x)


Fixed code:
q, h, s, d = map(int, input().split())
n = int(input())

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

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


Fixed code:
q, h, s, d = map(int, input().split())
n = int(input())
q = q * 4
h = h * 2

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