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

k = int(eval(input()))

print((a+b+c-max(a,b,c)+max(a,b,c)*(2 ** k)))

l = list(map(int,input().split()))

k = int(eval(input()))

L =l.sort()

print((int(l[0])+int(l[1])+int(l[2])*(2**k)))

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

l = list(map(int, input().split()))
k = int(eval(input()))
L = l.sort()
print((int(l[0]) + int(l[1]) + int(l[2]) * (2**k)))

-a, b, c = list(map(int, input().split())) +l = list(map(int, input().split())) -print((a + b + c - max(a, b, c) + max(a, b, c) * (2**k))) +L = l.sort() +print((int(l[0]) + int(l[1]) + int(l[2]) * (2**k)))