import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    const tmp = readln.split.to!(long[]).sort!((a,b) => a < b).array;
    const K = readln.chomp.to!long;
    writeln(tmp[0] + tmp[1] + tmp[2] * 2^^K);
}

