let a, b, c, k = Scanf.scanf " %d %d %d %d" @@ fun a b c d -> a, b, c, d
let d = ref @@ max a @@ max b c
let r = a + b + c - !d
let _ = for _ = 1 to k do d := 2 * !d done; Printf.printf "%d\n" @@ r + !d