object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val x :: xs = List.fill(3)(sc.nextInt()).sorted(Ordering[Int].reverse)
  println(math.pow(2, sc.nextDouble()).toInt * x + xs.sum)
}
