Problem:
 Score: 200 points    Problem Statement  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?      Constraints   A, B and C are integers between 1 and 50 (inclusive).  K is an integer between 1 and 10 (inclusive).         Input  Input is given from Standard Input in the following format:  A  B  C  K       Output  Print the largest possible sum of the integers written on the blackboard after K operations by E869220.        Sample Input 1 5 3 11
1      Sample Output 1 30  In this sample, 5, 3, 11 are initially written on the blackboard, and E869120 can perform the operation once. There are three choices:   Double 5 : The integers written on the board after the operation are 10, 3, 11 .  Double 3 : The integers written on the board after the operation are 5, 6, 11 .  Double 11 : The integers written on the board after the operation are 5, 3, 22 .   If he chooses 3., the sum of the integers written on the board afterwards is 5 + 3 + 22 = 30 , which is the largest among 1. through 3.       Sample Input 2 3 3 4
2      Sample Output 2 22  E869120 can perform the operation twice. The sum of the integers eventually written on the blackboard is maximized as follows:   First, double 4 . The integers written on the board are now 3, 3, 8 .  Next, double 8 . The integers written on the board are now 3, 3, 16 .   Then, the sum of the integers eventually written on the blackboard is 3 + 3 + 16 = 22 .

Solution (Python):
abc = input().split()

a = int(abc[0])
b = int(abc[1])
c = int(abc[2])
k = int(input())

d = max(a, b, c)
ab = a + b + c - d
for i in range(k):
    d *= 2

print(ab + d)

Solution (Python):
num = sorted(list(map(int,input().split())))
a = num[0]
b = num[1]
c = num[2]
k = int(input())
print(a+b+c*2**k)

Solution (Python):
a = sorted(list(map(int, input().split())))
k = int(input())
print(sum(a[:-1]) + a[-1] * (2 ** k))

Solution (Python):
a,b,c = map(int,input().split())
k = int(input())
num = [a,b,c]
for i in range(k):
    n = max(num)
    index_n = num.index(n)
    num[index_n] = num[index_n]*2
print(sum(num))

Solution (Python):
A, B, C = list(map(int, input().split()))
K = int(input())

ans = max([A, B, C]) * (2 ** K) - max([A, B, C])

print(ans + A + B + C)

Solution (Python):


a, b, c = map(int,input().split())
k = int(input())
abc = [a,b,c]
abc.sort()
blackboard = abc[-1] * (2 ** k) + abc[0] + abc[1]
print(blackboard)

Solution (Python):
num_list = sorted(list(map(int, input().split())))
k = int(input())
num_max = num_list.pop()
num_max = (2**k)*num_max
print(sum(num_list)+num_max)

Solution (Python):
ABC = [int(i) for i in input().split()]
ABC.sort()
K = int(input())
ABC[-1] = ABC[-1]*2**K
print(sum(ABC))

Solution (Python):
a=list(map(int,input().split()))
b=int(input())
print(sum(a)+max(a)*(2**b-1))

Solution (Python):
abc=list(map(int,input().split()))
k=int(input())
ma=max(abc)
print(ma*2**k+sum(abc)-ma)

Solution (Python):
A, B, C = sorted(map(int, input().split()))
K = int(input())

for _ in range(K):
    C *= 2
print(A+B+C)

Solution (Python):
a, b, c = sorted(map(int, input().split()))
k = int(input())

total = 0

for i in range(k):
    c *= 2

print(a+b+c)

Solution (Python):
a, b, c = sorted([int(i) for i in input().split()])
k = int(input())
for i in range(k):
    c = c * 2
ans = a+b+c
print(ans)

Solution (Python):
l=list(map(int,input().split()))
k=int(input())

for i in range(k):
    l.append(max(l)*2)
    l.remove(max(l)/2)

print(sum(l))

Solution (Python):
a = [int(item) for item in input().split()]
k = int(input())
a.sort()

for i in range(k):
  a[-1] *= 2
  
print(sum(a))

Solution (Python):
a, b, c = map(int,input().split())
k = int(input())
m = max(a,b,c)
print(a + b + c + m * 2 ** k - m)

Solution (Python):
a,x=list(map(int,input().split())),int(input());print(sum(a)+max(a)*((2**x)-1))

Solution (Python):
from sys import stdin
l = [int(x) for x in stdin.readline().rstrip().split()]
l.sort()
k = int(stdin.readline().rstrip())
print(l[2]*(2**k) + l[0] + l[1])

Solution (Python):
A, B, C = [int(x) for x in input().split()]
K = int(input())

for _ in range(K):
    if max(A, B, C) == A:
        A *= 2
    elif max(A, B, C) == B:
        B *= 2
    else:
        C *= 2
ans = A + B + C

print(ans)

Solution (Python):
A, B, C = list(map(int, input().split()))
K = int(input())
t = max(A, B, C)
print(sum([A, B, C]) - t + pow(2, K) * t)

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())
print(sum(sorted([a,b,c])[:2])+(max(a,b,c)*(2**k)))

Solution (Python):
a=list(map(int,input().split()))
a.sort()
k=int(input())
print(a[0]+a[1]+a[2]*(2**k))

Solution (Python):
l = list(map(int,input().split()))
K = int(input())
print(sum(l)+max(l)*(2**K-1))

Solution (Python):
a,b,c=sorted(map(int,input().split()));print(a+b+c*2**int(input()))

Solution (Python):
a,b,c=map(int,input().split());print(a+b+c+max(a,b,c)*(2**int(input()))-max(a,b,c))

Solution (Python):
A, B, C = map(int, input().split())
K = int(input())

print(A+B+C-max(A,B,C)+max(A,B,C)*2**K)

Solution (Python):
a, b, c = map(int, input().split())
k = int(input())

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

Solution (Python):
L = sorted(list(map(int,input().split(' '))))[::-1]
K = int(input())
print(L[1]+L[2]+(L[0]*(2**K)))

Solution (Python):
n=list(map(int,input().split()))
print(max(n)*(2**int(input())-1)+sum(n))

Solution (Python):
A, B, C = [int(_) for _ in input().split()]
K = int(input())
print(max(A, B, C) * ((2 ** K) - 1) + A + B + C)

Solution (Python):
def solve(string):
    *abc, k = map(int, string.split())
    abc = sorted(abc)
    for i in range(k):
        abc[-1] *= 2
    return str(sum(abc))


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Solution (Python):
a=list(map(int,input().split()))
K=int(input())
print(sum(a)+max(a)*(2**K-1))

Solution (Python):
A = list(map(int, input().split()))
K =int(input())
A = sorted(A)
print(A[0]+A[1]+A[2]*(2**K))

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())
m=max(a,b,c)
print(m*(1<<k)+a+b+c-m)

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

Solution (Python):
nums = list(map(int, input().split()))
K = int(input())
nums.sort()
print(sum(nums[:2]) + nums[2] * 2 ** K)

Solution (Python):
nums = list(map(int, input().split()))
k = int(input())

for i in range(k):

    i_ = nums.index(max(nums))
    nums[i_] = nums[i_] * 2

print(sum(nums))

Solution (Python):
abc = list(map(int, input().split()))
k = int(input())

idx = abc.index(max(abc))
abc[idx] *= 2**k
print(sum(abc))

Solution (Python):
A = list(map(int, input().split()))
K = int(input())
A.sort(reverse=True)
A[0] = A[0] * pow(2, K)
print(sum(A))

Solution (Python):
arr = list(map(int, input().split()))
k = int(input())
arr.sort()
arr[2] = arr[2] * (2 ** k)
print(sum(arr))

Solution (Python):
L = list(map(int, input().split()))
K = int(input())

maximum = max(L)
print(sum(L) - maximum + maximum * 2 ** K)

Solution (Python):


import sys


abc = list(map(int, input().split()))
k = int(input())
abc = sorted(abc)
abc[-1] = abc[-1]*2**k
print(sum(abc))

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

Solution (Python):

abc = list(map(int,input().split()))
k = int(input())
answer = sum(abc) - max(abc) + (max(abc)*(2**k))

print(answer)

Solution (Python):
a = sorted(list(map(int, input().split())), reverse=True)
print(a[0]*2**int(input())+a[1]+a[2])

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())
m=max(a,b,c)
sum=a+b+c-m
for i in range(k):
  m=m*2
print(m+sum)

Solution (Python):
list=list(map(int,input().split()))
k=int(input())
for i in range(k):
    m=max(list)
    list.append(2*m)
    list.remove(m)
print(sum(list))

Solution (Python):
a,b,c = map(int, input().split())
k = int(input())
ans = a+b+c + max(a,b,c)*(2**k-1)
print(ans)

Solution (Python):
a, b, c = (int(i) for i in input().split())
k = int(input())
print(a+b+c - max([a,b,c]) + max([a,b,c])*(2**k))

Solution (Python):
A,B,C=map(int,input().split())
K=int(input())
print(max(A,B,C)*2**K+sum((A,B,C))-max(A,B,C))

Solution (Python):
a,b,c  = map(int,input().split())
k = int(input())

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

Solution (Python):
A=list(map(int,input().split()))
K=int(input())
for i in range(K):
    A.sort(reverse=True)
    A[0] *= 2
print(sum(A))

Solution (Python):
def maximum_sum(A: int, B: int, C: int, K: int) -> int:
    A, B, C = sorted([A, B, C])
    return A + B + C * (2 ** K)


if __name__ == "__main__":
    A, B, C = map(int, input().split())
    K = int(input())
    ans = maximum_sum(A, B, C, K)
    print(ans)

Solution (Python):
A, B, C = map(int, input().split())
K = int(input())
li = [A, B, C]
i = 0
result = 0
while i != K:
    idx = li.index(max(li))
    li[idx] *= 2
    result = sum(li)
    i += 1
print(result)

Solution (Python):
a=list(map(int,input().split()))
a.sort()
k=int(input())
print(a[0]+a[1]+a[2]*2**k)

Solution (Python):
A,B,C = map(int,input().split())
K = int(input())

a = [A,B,C]
a.sort()
print(a[0]+a[1]+a[2]*pow(2,K))

Solution (Python):
a, b, c = sorted(map(int,input().split()))
K = int(input())

print(2**K*c+a+b)

Solution (Python):
Alist= sorted(list(map(int,input().split())),reverse=True)
K = int(input())
maxnum = Alist[0]
for i in range(K):
    maxnum*=2
print(maxnum+sum(Alist[1:]))

Solution (Python):
l=list(map(int, input().split()))
k=int(input())
m=max(l)
del l[l.index(m)]

for i in range(k):
    m*=2

print(m+sum(l))

Solution (Python):
A, B, C = map(int,input().split())
K = int(input())

x = max([A,B,C])

print(A+B+C+(2**K-1)*x)

Solution (Python):
a, b, c = map(int,input().split())
k = int(input())
l = [a,b,c]

for i in range(k):
    n = max(l)
    l.remove(max(l))
    l.append(n *2)

print(sum(l))

Solution (Python):

N = sorted(list(map(int, input().split())))
K = int(input())
print(N[0] + N[1] + N[2] * (2 ** K))

Solution (Python):
A, B, C = sorted(map(int,input().split()))
K = int(input())
print(A+B+2**K*C)

Solution (Python):
l=list(map(int,input().split()))
k=int(input())
m=max(l)
a=2**k*m
for i in range(len(l)):
    if l[i]==m:
        l[i]=a
        break

print(sum(l))

Solution (Python):
def main() -> None:
    A, B, C = map(int, input().split())
    K = int(input())
    m = [A, B, C]
    m.sort(reverse=True)
    ans = m[0] * (2 ** K)
    ans += sum(m[1:])
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

import sys

def main():
	tmp = input().split(" ")
	nums = [int(s) for s in tmp]
	counts = int(input())
	
	max_num = max(nums)
	for _ in range(counts):
		for i, val in enumerate(nums):
			if val == max_num:
				nums[i] = val * 2
				max_num = nums[i]
			
	print(nums[0] + nums[1] + nums[2])
		
if __name__ == "__main__":
	main()

Solution (Python):
A, B, C = map(int, input().split())
K = int(input())

ma = max(A, B, C)
ans = A + B + C - ma
ans += ma * (2 ** K)

print(ans)

Solution (Python):
A,B,C = map(int, input().split())
print(A+B+C+max(A,B,C)*((2**int(input()))-1))

Solution (Python):


import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
l = list(map(int, input().split()))
K = int(input())
ans = sum(l)-max(l)
ans += max(l)*(2**K)
print(ans)

Solution (Python):
arr=sorted(list(map(int,input().split())))[::-1]
n=int(input())
for i in range(n):
  arr[0]=max(arr)*2
  arr=sorted(arr)[::-1]
print(sum(arr))

Solution (Python):
n = list(map(int, input().split()))
k = int(input())
n.sort()
for i in range(k):
	n[-1] *= 2
print(n[-1] + n[-2] + n[-3])

Solution (Python):
a=list(map(int,input().split()))
a.sort()
print(a[0]+a[1]+a[2]*(2**int(input())))

Solution (Python):
def main():
    A, B, C = map(int, input().split())
    K = int(input())
    M = max([A, B, C])
    print((2**K-1)*M + A + B + C)


if __name__ == "__main__":
    main()

Solution (Python):
A = sorted([int(i) for i in input().split()])

n = int(input())

m = A.pop()
print(sum([m*2**n]+A))

Solution (Python):

abc = [int(x) for x in input().split()]
k = int(input())
abc.sort()
abc[-1] = abc[-1] * (2 ** k)
print(sum(abc))

Solution (Python):
abc = list(map(int, input().split()))
abc.sort()
k = int(input())
print(abc[-1] * 2 ** k + abc[0] + abc[1])

Solution (Python):
A, B, C = map(int, input().split())
K = int(input())
print(max(A, B, C) * 2 ** K + A + B + C - max(A, B, C))

Solution (Python):
L=[int(i) for i in input().split()]
L.sort()
K=int(input())
L[2]=L[2]*2**K
print(sum(L))

Solution (Python):
A,B,C = map(int,input().split())
K = int(input())
answer = max(A,B,C)

for x in range(0,K):
    answer *= 2

answer += A + B + C - max(A,B,C)

print(answer)

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

Solution (Python):
import sys

def main():
  input = sys.stdin.readline
  A = list(map(int, input().split()))
  K = int(input())
  
  A = sorted(A)
  ans = A[0] + A[1] + A[2] * 2**K
  print(ans)


if __name__ == '__main__':
  main()

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())

if(a>=b and a>=c):
  a=a*2**k
elif(b>=a and b>=c):
  b=b*2**k
else:
  c=c*2**k
  
print(int(a+b+c))

Solution (Python):
a,b,c = map(int,input().split())
k = int(input())
x = max(a,b,c)
print(a+b+c+x*2**k-x)

Solution (Python):
def main():
    nums = list(map(int, input().split()))
    K = int(input())
    for _ in range(K):
        nums = sorted(nums)
        nums[2] *= 2
    print(sum(nums))


if __name__ == "__main__":
    main()

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())
m=0
for i in range(k+1):
    for j in range(k+1-i):
        s=a*(2**i)+b*(2**j)+c*(2**(k-i-j))
        if m<s:
            m=s
print(m)

Solution (Python):
a,b,c=sorted(map(int,input().split()));print(2**int(input())*c+b+a)

Solution (Python):
a,b,c=sorted(map(int,input().split()));print(2**int(input())*c+b+a)

Solution (Python):
A, B, C = map(int, input().split())
K = int(input())
M = max(A, B, C)
S = A + B + C - M + M * (2 ** K)
print(S)

Solution (Python):
*a,b=list(map(int,open(0).read().split()));print(sum(sorted(a)[:2])+max(a)*2**b)

Solution (Python):
a = list(map(int, input().split()))
k = int(input())
m = max(a)
s = sum(a) - m
print(m * 2 ** k + s)

Solution (Python):
e = [int(i) for i in input().split()]
k = int(input())

print(max(e) * 2 ** k + sum(e) - max(e))

Solution (Python):
list = list(map(int, input().split()))
k = int(input())

print(max(list)*(2**k)+sum(list)-max(list))

Solution (Python):
A,B,C=map(int,input().split())
K=int(input())
if (A>=B) and (A>=C):
    print(A*2**K+B+C)
elif (B>=C) and (B>=A):
    print(B*2**K+A+C)
else:
    print(C*2**K+B+A)

Solution (Python):
x=list(map(int,input().split()))
k=int(input())
print(max(x)*(2**k)+sum(x)-max(x))

Solution (Python):

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

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())

abcmax=max(a,b,c)
new_abcmax=abcmax

for i in range(k):
    new_abcmax*=2

print(a+b+c+new_abcmax-abcmax)

Solution (Python):
a,b,c = map(int,input().split())
k = int(input())
d = max(a,b,c)
e = sum([a,b,c]) - d
for i in range(k):
    d *= 2
print(d+e)

Solution (Python):
int_a, int_b, int_c = list(map(int, input().split()))
int_k = int(input())


ar_order = sorted([int_a, int_b, int_c], reverse=True)

int_max = ar_order.pop(0)

for n in range(int_k):
    int_max *= 2


print(int_max + sum(ar_order))

Solution (Python):
A,B,C = map(int,input().split(" "))
K = int(input())
list = [A,B,C]
list = sorted(list,reverse = True)
for i in range(K):
    list[0] = list[0]*2

print(sum(list))

Solution (Python):
a = list(map(int,input().split()))
k = int(input())
for i in range(k):
    a[a.index(max(a))]*=2
print(sum(a))

Solution (Python):
A, B, C = sorted(map(int, input().split()))
K = int(input())
print(A + B + C * (2 ** K))

Solution (Python):
a,b,c=[int(i) for i in input().split()]
k=int(input())
maximum=max(a,b,c)
for i in range(k):
    maximum*=2
if a==max(a,b,c):
    a=maximum
elif b==max(a,b,c):
    b=maximum
else:
    c=maximum
print(a+b+c)

Solution (Python):
num = list(map(int, input().split()))
k = int(input())

print(sum(num) + max(num)*(2**k) - max(num))

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

Solution (Python):
b = list(map(int, input().split()))
k = int(input())
print(sum(b) + max(b)*(2**k-1) )

Solution (Python):
lst=sorted(list(map(int,input().split())))[::-1]
k=int(input())
print(sum(lst[1:])+lst[0]*(2**k))

Solution (Python):
a = list(map(int,input().split()))
n = int(input())
a.sort()
A = a[2]
for i in range(n):
    A *= 2
a.pop(2)
print(a[0]+a[1]+A)

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

Solution (Python):

aa = list(map(int,input().split()))
k=int(input())

print(sum(aa) - max(aa) + max(aa)*(2**k))

Solution (Python):

import sys



def solve(lines):
    K = list(map(int, lines.pop(0).split(' ')))
    N = int(lines.pop(0))
    K.sort()
    a = K.pop(-1)
    print(a * 2**N + sum(K))





lines = [x.strip() for x in sys.stdin.readlines()]



solve(lines)

Solution (Python):
abc_list = list(map(int,input().split()))
K = int(input())

for k in range(K):
    abc_list.sort(reverse = True)
    abc_list[0] = abc_list[0] * 2

print(sum(abc_list))

Solution (Python):


"""
Created on Mon Feb 11 05:38:56 2019

@author: shinjisu
"""



import math


def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def dmp(x):
    global debug
    if debug:
        print(x)


debug = True


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def zeros2(n, m): return [zeros(m)]*n


def prob095():
    X = getIntList()
    K = getInt()
    dmp((X, K))
    total = sum(X) - max(X) + max(X)*2**K
    return total


debug = False
print(prob095())

Solution (Python):
n = list(map(int, input().split()))
k = int(input())
n.sort()
print(n[0] + n[1] + n[2]*(2**k))

Solution (Python):
a,b,c = map(int,input().split())
k = int(input())
print(max(a,b,c)*(2**k-1)+a+b+c)

Solution (Python):
A, B, C = sorted(map(int,input().split()))
K = int(input())

for i in range(K):
  C *= 2
print(A + B + C)

Solution (Python):
a,b,c=sorted(map(int,input().split()))
k=int(input())
print(a+b+(c*2**k))

Solution (Python):
a=list(map(int,input().split()))
k=int(input())
t=max(a)
print(sum(a)+(t*2**k)-t)

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())
t=max(a,b,c)
print(a+b+c+(t*2**k)-t)

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())
d=max(a,b)
d=max(d,c)
e=d*2**k
print(a+b+c-d+e)

Solution (Python):
a,b,c=map(int, input().split())
k=int(input())
print(a+b+c-max([a,b,c])+max([a,b,c])*(2**k))

Solution (Python):
def main():
    abc = list(map(int, input().split()))
    K = int(input())
    print(sum(abc) - max(abc) + max(abc) * 2 ** K)


main()

Solution (Python):
def main():
    abc = list(map(int, input().split()))
    K = int(input())
    m = max(abc)
    abc.remove(m)
    print(sum(abc) + m * 2 ** K)


main()

Solution (Python):
L = list(map(int,input().split()))
K = int(input())
print(max(L)*2**K+sum(L)-max(L))

Solution (Python):
l=sorted(list(map(int,input().split())))
k=int(input())

l[2]=(2**k)*l[2]
print(sum(l))

Solution (Python):


















import collections
def inpl(): return list(map(int, input().split()))


a, b, c = map(int,input().split())
k = int(input())
m = max([a, b, c])

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

Solution (Python):
x=[int(i) for i in input().split()]
x.sort()
n=int(input())
print(x[2]*2**n+x[0]+x[1])

Solution (Python):
ABCs = list(map(int, input().split()))
K = int(input())

maxABC = max(ABCs)
print(sum(ABCs) - maxABC + maxABC*2**K)

Solution (Python):
a=list(map(int,input().split()))
k=int(input())
a.sort(reverse=True)
b=a.pop(0)
print(sum(a)+b*2**k)

Solution (Python):
abc = list(map(int, input().split()))
k = int(input())
print(sum(abc) - max(abc) + max(abc) * 2 ** k)

Solution (Python):
numbers = list(map(int,input().split()))
k = int(input())
for _ in range(k):
    max_pos = numbers.index(max(numbers))
    numbers[max_pos] *= 2
print(sum(numbers))

Solution (Python):
def main():
    v = [int(i) for i in input().split()]
    k = int(input())

    
    
    
    
    
    
    
    

    mx = max(v)
    v.remove(mx)

    ans = mx * (2 ** k) + sum(v)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    a, b, c = map(int, input().split())
    k = int(input())

    ans = 0
    for i, m in enumerate(sorted([a, b, c], reverse=True)):
        if i == 0:
            ans += m * (2 ** k)
        else:
            ans += m

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
abclist = [int(x) for x in input().split()]
k = int(input())
abclist.sort(reverse=True)
abclist[0] = abclist[0] * (2**k)
print(sum(abclist))

Solution (Python):
a = list(map(int, input().split()))
k = int(input())
a = sorted(a)
print(sum(a)-a[-1]+2**k*a[-1])

Solution (Python):
"""AtCoder"""

abc = list(map(int, input().split()))
K = int(input())

abc.sort()

for _ in range(K):
    abc[2] = abc[2] * 2

print(abc[0] + abc[1] + abc[2])

Solution (Python):
A,B,C = map(int,input().split())
K = int(input())
maxV = max(A,B,C)
print(A+B+C-maxV+maxV*2**K)

Solution (Python):
A = sorted(list(map(int,input().split())))
K = int(input())
print(A[0]+A[1]+A[2]*(2**K))

Solution (Python):
L = list(map(int,input().split()))
K = int(input())
m = max(L)
print(sum(L)-m + m* (2 ** K))

Solution (Python):
L = [list(map(int,input().split()))]
K = int(input())
import copy

def peice_double(L):
    l = []
    for x in L:
        tmp = copy.copy(x)
        for i in range(3):
            tmp[i] = tmp[i] * 2
            l.append(copy.copy(tmp))
            tmp[i] = tmp[i] // 2
    return l
for i in range(K):
    L = peice_double(L)
ans = 0
for x in L:
    ans = max(ans, sum(x))
print(ans)

Solution (Python):
a=list(map(int,input().split()))
k=int(input())
a.sort()
print(a[2]*2**k+a[0]+a[1])

Solution (Python):
a,b,c = map(int,input().split())
k = int(input())
print(max(a,b,c)*(2**k) + min(a,b,c) + (a+b+c-max(a,b,c)-min(a,b,c)))

Solution (Python):
a, b, c = (int(x) for x in input().split())
k = int(input())
res =0

res += sum((a,b,c)) + max(a,b,c)*(2**k) - max(a,b,c)

print(res)

Solution (Python):
l = sorted(list(map(int, input().split())))
k = int(input())
print(sum(l) + l[2]*(2**k - 1 ))

Solution (Python):
l = sorted(list(map(int,input().split())))
K = int(input())
print(sum(l)+(2**K-1)*l[2])

Solution (Python):
A,B,C = map(int,input().split())
K = int(input())

max = sorted([A,B,C])[2]

print(A+B+C+(2**K-1)*max)

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())
x=[a,b,c]
x.sort()
x.reverse()
print(x[0]*pow(2,k)+x[1]+x[2])

Solution (Python):
A = list(map(int, input().split()))
k = int(input())
x = max(A)

for _ in range(k):
    x *= 2
    
print(sum(A) - max(A) + x)

Solution (Python):
a = list(map(int,input().split()))
k = int(input())
a.sort()
print(a[0]+a[1]+a[2]*2**k)

Solution (Python):
a = list(map(int,input().split()))
k = int(input())
print(sum(a)-max(a)+max(a)*(2**k))

Solution (Python):
number = list(map(int, input().split()))
K = int(input())
number.sort()
for i in range(K):
    number[2] *= 2
print(sum(number))

Solution (Python):
lis = list(map(int,input().split()))
K = int(input())
s=sum(lis)-max(lis)+max(lis)*2**K
print(s)

Solution (Python):
l = list(map(int, input().split()))
k = int(input())
l.sort(reverse=True)
ans = l[0] * (2 ** k) + l[1] + l[2]
print(ans)

Solution (Python):


def main():
    na = list(map(int, input().split()))
    A, B, C = na[0], na[1], na[2]
    K = int(input())

    print(A + B + C + max(A, B, C) * (2 ** K - 1))


if __name__ == '__main__':
    main()

Solution (Python):
a = list(map(int, input().split()))
a.sort()
k = int(input())
print(a[0] + a[1] + a[2]*(2**k))

Solution (Python):
def a(abc,k):
    return abc[-1]*2**k+abc[0]+abc[1]
print(a(sorted([int(i) for i in input().split()]),int(input())))

Solution (Python):
abc=[int(i) for i in input().split()]
k=int(input())
abc.sort()
print(abc[-1]*2**k+abc[0]+abc[1])

Solution (Python):
li = list(map(int,input().split()))
k=int(input())
li.sort(reverse=True)
for i in range(k):
  li[0] = li[0]*2
print(li[0]+li[1]+li[2])

Solution (Python):
def piyo():
    hoge = list(int(i) for i in input().split())  
    n = int(input())
    m = hoge.index(max(hoge))
    for _ in range(n):
        hoge[m] = hoge[m]*2
    print(sum(hoge))
        
if __name__ == '__main__':
    piyo()

Solution (Python):
n=list(map(int,input().split()))
k=int(input())
n.sort(reverse=True)
print(n[0]*(2**k)+n[1]+n[2])

Solution (Python):
A, B, C = map(int, input().split())
K = int(input())
m = max(A, B, C)
print(A + B + C + m * (2 ** K - 1))

Solution (Python):
a, b, c = map(int, input().split())
k = int(input())
print(a+b+c+max(a,b,c)*(2**k-1))

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

Solution (Python):
a,b,c=sorted(map(int,input().split()))
print(a+b+c*2**int(input()))

Solution (Python):
l=[int(_) for _ in input().split()]
print(max(l)*2**int(input())+sum(l)-max(l))

Solution (Python):
l=[int(_) for _ in input().split()]
k=int(input())
print(max(l)*2**k+sum(l)-max(l))

Solution (Python):
l=[int(_) for _ in input().split()]
k=int(input())
for i in range(k):l[l.index(max(l))]=max(l)*2
print(sum(l))

Solution (Python):
import sys
A,B,C = [int(n) for n in input().split()]
K = int(input())
ans = A+B+C + max(A,B,C)*(2**K-1)

print(ans)

Solution (Python):
a,b,c=map(int,input().split())
print(max(a,b,c)*(2**int(input()))+a+b+c-max(a,b,c))

Solution (Python):
a, b, c = map(int, input().split())

max_n = max(a, b, c)

n = int(input())

ans = max_n*2**n + a+b+c-max_n

print(ans)

Solution (Python):
A, B, C = [int(x) for x in input().split()]
K = int(input())

i = 2 ** K
a = A * i + B + C
b = A + B * i + C
c = A + B + C * i

print(max(a, b, c))

Solution (Python):
abc = list(map(int, input().split()))
K = int(input())
abc[abc.index(max(abc))] *= 2**K
print(sum(abc))

Solution (Python):
l = list(map(int,input().split()))
k = int(input())
L = sorted(l,reverse = True)
print(L[0]*(2**k)+L[1]+L[2])

Solution (Python):

import sys
input = sys.stdin.readline

lst_abc = list(map(int, input().split()))
K = int(input())

ans = sum(lst_abc) + max(lst_abc) * (pow(2, K) - 1)
print(ans)

Solution (Python):
a, b, c = list(map(int, input().split()))
k = int(input())

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

Solution (Python):
A,B,C=map(int,input().split())
K=int(input())

black_board=[A,B,C]
for i in range(K):
    max_index=black_board.index(max(black_board))
    black_board[max_index]*=2
sum=0
for i in range(len(black_board)):
    sum+=black_board[i]

print(sum)

Solution (Python):
numbers = list(map(int, input().split()))
K = int(input())
print(sum(numbers)-max(numbers)+max(numbers)*(2**K))

Solution (Python):
A, B, C = map(int,input().split())
K = int(input())
ans = [A+B+C*(2**K),C+B+A*(2**K),C+A+B*(2**K)]
print(max(ans))

Solution (Python):
A,B,C = map(int,input().split())
K = int(input())
s = max(A,B,C)
noko = A+B+C-s
for i in range(K):
    s = s*2
print(noko+s)

Solution (Python):
l = list(map(int,input().split()))
K = int(input())
l.sort()

print(l[0]+l[1]+l[2]*2**(K))

Solution (Python):
A=input().strip().split(" ")
A=[int(i) for i in A]
K=int(input())
count=0

A.sort()

A[2]=A[2]*(2**K)

for i in range(3):
    count+=A[i]

print(count)

Solution (Python):



def main():
    """Function."""
    num = list(map(int, input().split()))
    k = int(input())

    max_num = max(num)
    rest = sum(num) - max_num
    for _ in range(k):
        max_num *= 2

    print(rest + max_num)


if __name__ == "__main__":
    main()

Solution (Python):
a, b, c = sorted(map(int, input().split()), reverse=True)
k = int(input())
print(a*2**k + b + c)

Solution (Python):
A,B,C=map(int,input().split())
K=int(input())
if(A==max(A,B,C)):
    print(A*(2**K)+B+C)
elif(B==max(A,B,C)):
    print(A+B*(2**K)+C)
else:
    print(A+B+C*(2**K))

Solution (Python):
A,B,C=map(int,input().split())
K=int(input())
M=max(max(A,B),C)
print(M*(2**K)+A+B+C-M)

Solution (Python):
abc = [int(n) for n in input().split()]
K = int(input())
print(sum(abc)-max(abc)+max(abc)*(2**K))

Solution (Python):
abc = [int(n) for n in input().split()]
K = int(input())

for _ in range(K):
    abc.sort()
    abc[-1] = abc[-1]*2
print(sum(abc))

Solution (Python):
a = list(map(int, input().split()))
b = int(input())
a.sort()
c = a[::-1]
d = c[0]


for i in range(b):
    c[0] +=c[0]
print(sum(c))

Solution (Python):
def main():
    xs = sorted(map(int, input().split()))
    k = int(input())
    for _ in range(k):
        xs[-1] *= 2
    print(sum(xs))


if __name__ == '__main__':
    main()

Solution (Python):
a = list(map(int, input().split()))
print((sum(a)-max(a))+max(a)*(2**int(input())))

Solution (Python):
from statistics import mean, median,variance,stdev
import sys
import math
import fractions
def j(a):
    if a==1: print("Yes")
    else :print("No")


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())





a = [int(i) for i in input().split()]        



x = ip()
a.sort()
for i in range(x):
    a[2]*=2
print(sum(a))

Solution (Python):
a=[int(i) for i in input().split()]
a.sort()
k=int(input())

ans=a[0]+a[1]+a[2]*(2**k)
print(ans)

Solution (Python):
li = [int(i) for i in input().split()]
K = int(input())

max_v = max(li)
max_i = li.index(max_v)
for i in range(K) :
    max_v *= 2

li[max_i] = max_v
print(sum(li))

Solution (Python):

A,B,C=map(int,input().split())
K = int(input())
S = max(A,B,C) 
L = [A,B,C] 
L.remove(S)
P = sum(L , S*2**K)
print(P)

Solution (Python):
a, b, c = map(int, input().split())
k = int(input())
print(max(a, b, c) * 2**k + (sum([a, b, c]) -max(a, b, c)))

Solution (Python):
v = list(map(int,input().split()))
k = int(input())

v.sort()
for _ in range(k):
    v[-1] *= 2
print(sum(v))

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())
ans=(max(a,b,c)*2**(k)+a+b+c-max(a,b,c))
print(ans)

Solution (Python):
ar = list(map(int,input().split(" ")))
a = int(input())
for i in range(a):
    ar[ar.index(max(ar))] *= 2
print(sum(ar))

Solution (Python):
abc = list(map(int,input().split()))
k = int(input())

abc.sort()

abc[2] = abc[2]*2**k
print(sum(abc))

Solution (Python):
a,b,c = sorted(map(int, input().split()))
k = int(input())
print(a+b+c*2**k)

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())
m=max(a,max(b,c))
n=m
for _ in range(k):
    m = m * 2
print(a+b+c+m-n)

Solution (Python):

import math

ary = list(map(int, input().split()))
i = int(input())


x_ = max(ary)
sum_ = sum(ary)-x_

print ( sum_ + int(x_*math.pow(2,i)) )

Solution (Python):
a = [int(i) for i in input().split()]
k = int(input())
a.sort()
print(a[len(a)-1]*2**k+sum(a)-a[len(a)-1])

Solution (Python):
a, b, c = [int(i) for i in input().split()]
k = int(input())
m = max(a, b, c)
print(a + b + c + m*(2 ** k) - m)

Solution (Python):
a=list(map(int,input().split()))
k=int(input())
print(sum(a)+(2**k-1)*max(a))

Solution (Python):
A, B, C = map(int, input().split())
print(max(A, B, C) * 2 ** int(input()) + A + B + C - max(A, B, C))

Solution (Python):
A, B, C = map(int,input().split(" "))
K = int(input())
other = A + B + C - max(A,B,C)
print(other + max(A,max(B,C))*(2**K))