output_description: Print the smallest number of yen you have to spend to buy exactly N liters of
  ice tea.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      Q H S D
      N
attempt: if __name__ == "__main__":
      Q, H, S, D = map(int, input().split())
      N = int(input())
      q, h, s, d = [0.25, 0.5, 1, 2]
      cost_d = 0
      cost_s = 0
      cost_h = 0
      cost_q = 0
      if N > d:
          N_d = N
          while N_d > d:
              N_d -= d
              cost_d += D
          while N_d > s:
              N_d -= s
              cost_d += S
          while N_d > h:
              N_d -= h
              cost_d += H
          while N_d > 0:
              N_d -= q
              cost_d += Q
      elif N > s:
          N_s = N
          while N_s > s:
              N_s -= s
              cost_s += S
          while N_s > h:
              N_s -= h
              cost_s += H
          while N_s > 0:
              N_s -= q
              cost_s += Q
      elif N > h:
          N_h = N
          while N_h > h:
              N_h -= h
              cost_h += H
          while N_h > 0:
              N_h -= q
              cost_h += Q
      else:
          N_q = N
          while N_q > 0:
              N_q -= q
              cost_q += Q
      ans = min(cost_d, cost_s, cost_h, cost_q)
      print(ans)
  
problem_description: 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?
samples: [{"input": "20 30 70 90\n    3", "output": "150\n    \n\nBuy one 2-liter bottle and two 0.5-liter bottles. You'll get 3 liters for 90 +\n30 + 30 = 150 yen.\n\n* * *"}, {"input": "10000 1000 100 10\n    1", "output": "100\n    \n\nEven though a 2-liter bottle costs just 10 yen, you need only 1 liter. Thus,\nyou have to buy a 1-liter bottle for 100 yen.\n\n* * *"}, {"input": "10 100 1000 10000\n    1", "output": "40\n    \n\nNow it's better to buy four 0.25-liter bottles for 10 + 10 + 10 + 10 = 40 yen.\n\n* * *"}, {"input": "12345678 87654321 12345678 87654321\n    123456789", "output": "1524157763907942"}]