let main () =
  let a, b, c = Scanf.scanf "%d %d %d\n" (fun a b c -> a, b, c) in
  let k = Scanf.scanf "%d\n" (fun a -> a) in
  let rec pow i j = if j = 1 then i else pow (i * i) (j - 1) in
  let ans1 = a * (pow 2 k) + b + c in
  let ans2 = a + b * (pow 2 k) + c in
  let ans3 = a + b + c * (pow 2 k) in
  Printf.printf "%d\n" (max (max ans1 ans2) ans3);;

let _ = main ()
