Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
a=list(map(int, input().split()))
b=2＊a[3]＊a[2]
c=a[2]＊a[4]＊2+a[0]＊(a[3]-a[4])
d=2＊a[4]＊a[2]
e=a[2]＊a[3]＊2+a[1]＊(a[4]-a[3])
f=a[0]＊a[3]+a[1]＊a[4]
g=min(b,c,f)
h=min(d,e,f)
if a[3]>=a[4]:
    print(g)
else:
    print(h)


a, b, c, x, y=map(int, input().split())
m=2＊x＊c
n=c＊y＊2+a＊(x-y)
d=2＊y＊c
e=c＊x＊2+b＊(y-x)
f=a＊x+b＊y
g=min(m,n,f)
h=min(d,e,f)
if x>=y:
    print(g)
else:
    print(h)


a, b, c, x, y=map(int, input().split())
m=2＊x＊c
n=c＊y＊2+a＊(x-y)
d=2＊y＊c
e=c＊x＊2+b＊(y-x)
f=a＊x+b＊y
g=min(m,n,f)
h=min(d,e,f)
if a[3]>=a[4]:
    print(g)
else:
    print(h)


a=list(map(int, input().split()))
if a[0]+a[1]>=a[2]＊2:
    if a[3]>=a[4]:
        print min(2＊a[3]＊a[2], (a[2]＊a[4]＊2+a[0]＊(a[3]-a[4])))
    else:
        print min(2＊a[4]＊a[2], (a[2]＊a[3]＊2+a[1]＊(a[4]-a[3])))
else:
    print (a[0]＊a[3]+a[1]＊a[4])


a=list(map(int, input().split()))
if a[0]+a[1]>=a[2]＊2:
    if a[3]>=a[4]:
        print max(2＊a[3]＊a[2], (a[2]＊a[4]＊2+a[0]＊(a[3]-a[4])))
    else:
        print max(2＊a[4]＊a[2], (a[2]＊a[3]＊2+a[1]＊(a[4]-a[3])))
else:
    print (a[0]＊a[3]+a[1]＊a[4])


a=list(map(int, input().split()))
if a[0]+a[1]>=a[2]＊2 :
    if a[3]>=a[4]:
        print (a[2]＊a[4]+a[0]＊(a[3]-a[4]))
    else:
        print (a[2]＊a[3]+a[1]＊(a[4]-a[3]))
else:
    print (a[0]＊a[3]+a[1]＊a[4])

a=list(map(int, input().split()))
b=2＊a[3]＊a[2]
c=a[2]＊a[4]＊2+a[0]＊(a[3]-a[4])
d=2＊a[4]＊a[2]
e=a[2]＊a[3]＊2+a[1]＊(a[4]-a[3])
f=a[0]＊a[3]+a[1]＊a[4]
g=min(b,c,f)
h=min(d,e,f)
if a[3]>=a[4]:
    print(g)
else:
    print(h)

print 1

a=list(map(int, input().split()))
if a[0]+a[1]>=a[2]＊2:
    if a[3]>=a[4]:
        print (min(2＊a[3]＊a[2], (a[2]＊a[4]＊2+a[0]＊(a[3]-a[4]))))
    else:
        print (min(2＊a[4]＊a[2], (a[2]＊a[3]＊2+a[1]＊(a[4]-a[3]))))
else:
    print (a[0]＊a[3]+a[1]＊a[4])


a=list(map(int, input().split()))
if a[0]+a[1]>=a[2]＊2 :
  if a[3]>=a[4]:
    print (a[2]＊a[4]+a[0]＊(a[3]-a[4]))
  else:
    print (a[2]＊a[3]+a[1]＊(a[4]-a[3]))
else:
  print (a[0]＊a[3]+a[1]＊a[4])


a=list(map(int, input().split()))

print 1


a=list(map(int, input().split()))
b=2＊a[3]＊a[2]
c=a[2]＊a[4]＊2+a[0]＊(a[3]-a[4])
d=2＊a[4]＊a[2]
e=a[2]＊a[3]＊2+a[1]＊(a[4]-a[3])
f=a[0]＊a[3]+a[1]＊a[4]
if a[3]>=a[4]:
  print(min(b,c,f))
else:
  print(min(d,e,f))


a=list(map(int, input().split()))
b=2＊a[3]＊a[2]
c=a[2]＊a[4]＊2+a[0]＊(a[3]-a[4])
d=2＊a[4]＊a[2]
e=a[2]＊a[3]＊2+a[1]＊(a[4]-a[3])
f=a[0]＊a[3]+a[1]＊a[4]
g=min(b,c,f)
h=min(d,e,f)
if a[3]>=a[4]:
    print(g)
else:
    print(h)


a=list(map(int, input().split()))
b=2＊a[3]＊a[2]
c=a[2]＊a[4]＊2+a[0]＊(a[3]-a[4])
d=2＊a[4]＊a[2]
e=a[2]＊a[3]＊2+a[1]＊(a[4]-a[3])
f=a[0]＊a[3]+a[1]＊a[4]
if a[3]>=a[4]:
    print(min(b,c,f))
else:
    print(min(d,e,f))


a=list(map(int, input().split()))
b=2＊a[3]＊a[2]
c=a[2]＊a[4]＊2+a[0]＊(a[3]-a[4])
d=2＊a[4]＊a[2]
e=a[2]＊a[3]＊2+a[1]＊(a[4]-a[3])
f=a[0]＊a[3]+a[1]＊a[4]
if a[3]>=a[4]:print(min(b,c,f))
else:print(min(d,e,f))


a=list(map(int, input().split()))
if a[0]+a[1]>=a[2]＊2:
    if a[3]>=a[4]:
        print (a[2]＊a[4]＊2+a[0]＊(a[3]-a[4]))
    else:
        print (a[2]＊a[3]＊2+a[1]＊(a[4]-a[3]))
else:
    print (a[0]＊a[3]+a[1]＊a[4])


a, b, c, x, y=map(int, input().split())
m=2*x*c
n=c*y*2+a*(x-y)
d=2*y*c
e=c*x*2+b*(y-x)
f=a*x+b*y
g=min(m,n,f)
h=min(d,e,f)
if x>=y:
    print(g)
else:
    print(h)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted