open Batteries

let () =
  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 m = max a (max b c) in

  let rec t2 init n =
    if n = 0 then init
    else t2 (init * 2) (n-1)
  in

  print_endline (string_of_int (a + b + c - m + (t2 m k)))
