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):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
gosa = 1.0 / 10**10
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    a = sorted(list(zip(LI(),[0.25,0.5,1.0,2.0])), key=lambda x: x[0]/x[1])
    n = I() * 4
    r = 0
    for i in range(4):
        k,t = a[i]
        t = int(t*4)
        if n >= t:
            r += k * (n//t)
            n %= t

    return r

print(main())

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)

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

Solution (Python):
a = map(int, raw_input().split())
n = input() * 4
v = [1, 2, 4, 8]

for i in xrange(4):
    t = a[i]
    for j in xrange(i + 1, 4):
        t *= 2
        a[j] = min(a[j], t)

ans = 0

for i in xrange(3, -1, -1):
    ans += (n / v[i]) * a[i]
    n %= v[i]

print ans

Solution (Python):
Q,H,S,D = map(int, raw_input().split())
N = 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())
q1=Q
q2=min(2*q1,H)
q4=min(2*q2,S)
q8=min(2*q4,D)
if N%2==0:
  print(N//2*q8)
else:
  print(N//2*q8+q4)

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

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

Solution (Python):


def main():
    q, h, s, d = map(int, input().split())
    n = int(input())
    a = min([4 * q, 2 * h, s])
    if 2 * a <= d:
        return n * a
    else:
        return (n//2) * d + (n % 2) * a


print(main())

Solution (Python):
A = []
A = map(int, raw_input().split(' '))
pow = [1, 2, 4, 8]

N = int(raw_input())
N *= 4

for i in range(len(A) - 1):
	A[i + 1] = min(A[i] * 2, A[i + 1])

res = 0
for i in range(len(A) - 1, -1, -1):
	floor = N / pow[i]
	res += floor * A[i]
	N %= pow[i]

print res

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

Solution (Python):

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

if __name__ == '__main__':
    main()

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)
print(d*(n//2) + s*(n%2))