A, B, C = sorted(map(int,input().split()))

K = int(eval(input()))



for i in range(K):

  C *= 2

print((A + B + C))
A, B, C = sorted(map(int,input().split()))

K = int(eval(input()))

for _ in range(K):

  C *= 2

print((A+B+C))
A, B, C = sorted(map(int, input().split()))
K = int(eval(input()))
for i in range(K):
    C *= 2
print((A + B + C))

A, B, C = sorted(map(int, input().split()))
K = int(eval(input()))
for _ in range(K):
    C *= 2
print((A + B + C))

-for i in range(K): +for _ in range(K):