a,b,c = list(map(int,input().split()))

k = int(eval(input()))

print((a+b+c+max(a,b,c)*2**k-max(a,b,c)))
a,b,c = list(map(int,input().split()))

k = int(eval(input()))

l = [a,b,c]

print((max(l)*2**k + sum(l) - max(l)))
a, b, c = list(map(int, input().split()))
k = int(eval(input()))
print((a + b + c + max(a, b, c) * 2**k - max(a, b, c)))

a, b, c = list(map(int, input().split()))
k = int(eval(input()))
l = [a, b, c]
print((max(l) * 2**k + sum(l) - max(l)))

-print((a + b + c + max(a, b, c) * 2**k - max(a, b, c))) +l = [a, b, c] +print((max(l) * 2**k + sum(l) - max(l)))