// B: Maximum Sum
"use strict";

const DEBUG_MODE = false;
const rawInput = DEBUG_MODE
  ? "3 3 4\n2"
  : require("fs")
      .readFileSync("/dev/stdin", "utf8")
      .trim();

const process = inputRaw => {
  const inputs = inputRaw.split("\n");
  const integerList = inputs[0].split(" ").map(item => parseInt(item));
  const K = inputs[1];
  let max = Math.max.apply(Math, integerList);
  let maxIndex = integerList.indexOf(max);

  for (let i = 0; i < K; i++) {
    max = 2 * max;
  }

  console.log(
    integerList.reduce(
      (acc, curr, index) => acc + (index === maxIndex ? max : curr),
      0
    )
  );
};

process(rawInput);
