import scala.io.StdIn

object Main extends App {
  val source = StdIn.readLine.split(" ").map(_.toInt)
  val m = source.max
  val k = StdIn.readLine.toInt
  val mk = m << k
  val res = source.sorted.updated(source.length-1, mk)
  println(res.sum)
}