object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val prices = Map(
    0.25d -> sc.nextLong(),
    0.5d -> sc.nextLong(),
    1d -> sc.nextLong(),
    2d -> sc.nextLong()
  )
  val n = sc.nextLong()
  val cosp = prices.map{ case (s, p) => (s, (p / s).toLong)}.toList.sortBy(_._2).map(_._1)
  val ans = cosp.foldLeft((n, 0L))((rc, key) => {
    key match {
      case 2.0d if rc._1 >= 2 => ((rc._1 % key).toLong, rc._2 + ((rc._1 / key).toLong * prices(key)).toLong)
      case 2.0d if rc._1 < 2 => rc
      case _ => (0L, rc._2 + (rc._1 / key).toLong * prices(key))
    }
  })
  println(ans._2)
}
