There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times:    * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n.  What is the largest possible sum of the integers written on the blackboard after K operations?
a, b, c = map(int, input().split())
K = int(input())

testA = 0
if testA < a:
    testA = a
if testA < b:
    testA = b
if testA < c:
    testA = c
  
ans = a + b + c + testA * (K-1)
print(ans)
a, b, c = map(int, input().split())
K = int(input())

A = 0
if A < a:
    A = a
if A < b:
    A = b
if A < c:
    A = c
  
ans = a + b + c - A + A * 2**K
print(ans)