let main () =
  let a, b, c = Scanf.scanf "%d %d %d\n" (fun a b c -> ref a, ref b, ref c) in
  let k = Scanf.scanf "%d\n" (fun a -> a) in
  for i = 1 to k do
    if a >= b && b >= c then a := !a * 2 else
    if a <= b && b >= c then b := !b * 2 else
    if a <= b && b <= c then c := !c * 2
  done;
  Printf.printf "%d\n" (!a + !b + !c);;

let _ = main ()
