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):
if __name__ == '__main__':
    values = list(map(int, input().split()))
    k = int(input())

    max_index = 0
    max_value = values[0]
    for i in range(1, len(values)):
        if max_value < values[i]:
            max_index = i
            max_value = values[i]

    del values[max_index]
    answer = sum(values) + max_value * (2 ** k)
    print(answer)

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

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

k=int(input())
a.sort()
for i in range(k):
    a[2]*=2
print(sum(a))

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

Ans=sum(X)+max(X)*(2**K)-max(X)

print(Ans)

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

Solution (Python):
import sys

a, b, c = map(int, sys.stdin.readline().strip().split(" "))
k = int(sys.stdin.readline().strip())

m = a
others = b + c

if m < b:
    m = b
    others = a + c
if m < c:
    m = c
    others = a + b

print(m * (2 ** k) + others)

Solution (Python):
N = map(int, raw_input().split())

K = int(raw_input())

sortN = sorted(N)

for i in range(K):
    sortN[-1] = sortN[-1] * 2

print(sum(sortN))

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

m = max(l)
print(m*(2**k) + sum(l) - m)

Solution (Python):
a,b,c = input().split()
a = int(a)
b = int(b)
c = int(c)
L = []
L.append(a)
L.append(b)
L.append(c)
L.sort(reverse=True)
K = int(input())
ans = L[0]*2**K + L[1] + L[2]
print(ans)

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

m = max(a)

print(sum(a) - m + m*2**k)

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

max_val = max(A, B, C)
answer = A + B + C - max_val + max_val * (2 ** K)

print(answer)

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

max_num = max(A, B, C)
total = A + B + C
for k in range(K):
    total += max_num * (2 ** k)
print(total)

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

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

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

for i in range(k):
    s += max(a,b,c)
    if max(a,b,c) == a:
        a*=2
    elif max(a,b,c) == b:
        b*=2
    else:
        c*=2        
print(s)

Solution (Python):
num = list(map(int, input().split()))
num.sort()
k = int(input())
for _ in range(k):
    num[-1] *= 2
print(sum(num))

Solution (Python):
nums = list(map(int, input().split()))
K=int(input())
s=0
for i in nums:
  s+=i
print((2**K-1)*max(nums)+s)

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

x = max(a, b, c)
for i in range(k):
    x *= 2

if max(a, b, c) == a:
    print(x+b+c)
elif max(a, b, c) == b:
    print(a+x+c)
else:
    print(a+b+x)

Solution (Python):
a,b,c = map(int,input().split())
k = int(input())
d,e,f = sorted([a,b,c])

print(f*(2**k)+e+d)

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

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

Solution (Python):
a, b, c = map(int, input().split())
k = int(input())
d = max(a, max(b, c))
if d == a:
    print((a * (2 ** k)) + b + c)
elif d == b:
    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())
pow = max(a, b, c) * (2 ** k)
print(a + b + c + pow - max(a, b, c))

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

    nmax = max(A, B, C)
    etc = (A + B + C) - nmax
    ans = nmax * (2 ** K) + etc
    print(ans)

main()

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

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

Solution (Python):


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

K = int(input())



l = sorted([A, B, C])
m = l[-1]
rest = l[:-1:]




total = m * 2 ** K + sum(rest)
print(total)

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

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

k = int(input())

a = num2[-1]

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

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

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

Solution (Python):


import math

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

arr.sort()
arr.reverse()

print(arr[0] * int(math.pow(2, k)) + arr[1] + arr[2])

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

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

Solution (Python):

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

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

Solution (Python):
import copy

A = input().split()
B = int(A[1])
C = int(A[2])
A = int(A[0])
K = int(input())

def dfs(L, k, ans):
    if k >= K:
        ans[0] = max(ans[0], sum(L))
        return
    for i in range(3):
        L_ = copy.deepcopy(L)
        L_[i] *= 2
        dfs(L_, k + 1, ans)

ans = [0]
dfs([A, B, C], 0, ans)
print(ans[0])

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

print(sum(line) + max(line)*(2**K-1))

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

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

m = (2 ** k) * max(nums)
r = sum(nums) - max(nums)
print(m + r)

Solution (Python):
import numpy as np

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

a[np.argmax(a)] = max(a) * (2 ** k)

print(sum(a))

Solution (Python):
def abc096_b():
    import numpy as np
    abc = list(map(int, input().split()))
    k = int(input())
    num = np.max(abc)
    argnum = np.argmax(abc)
    abc.remove(abc[argnum])

    return np.sum(abc) + num * (2 ** k)


print(abc096_b())

Solution (Python):
l = sorted(list(map(int, input().split())))
k = int(input())
temp = l[-1]
for i in range(k):
  temp *= 2

print(sum(l[:2])+temp)

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

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

print(sum(A))

Solution (Python):
import math

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

a=max(x)*pow(2,K)

sum=sum(x)-max(x)+a

print(sum)

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

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

m = max(l)
s = sum(l)
print(m * (2 ** k) + s - m)

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

Solution (Python):

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

maximum = max(nums)
ans = sum(nums) - maximum + pow(2,K) * maximum
print(ans)

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= (int(i) for i in input().split()) 
k = int(input())
m = max(a,b,c)*2**k
print(a+b+c-max(a,b,c)+m)

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

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

lst = list(reversed(sorted(lst)))

print(lst[0]*2**K + sum(lst[1:]))

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

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

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

a.sort()
print(a[2] * (2 ** K) + a[0] + a[1])

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

t1,t2,t3 = sorted([A,B,C])
ans = t1 + t2 + (t3 * (2**K))
print(ans)

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

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

    x, y, z = sorted([A, B, C])
    for i in range(K):
        z *= 2
    ans = x + y + z
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

a, b, c = map(int, input().split())
K = int(input())
d = (2**K - 1)*max([a, b, c])
print(a+b+c+d)

Solution (Python):
nums = list(map(int, input().split()))
K = int(input())
ans = sum(nums) - max(nums) + (max(nums) << K)
print(ans)

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

m = max(nums)
s += m * (2**k - 1)
print(s)

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 = map(int, input().split())
K = int(input())
maxi =max(A,B,C)

print(A+B+C-maxi+maxi*(2**K))

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

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

print(sum(a))

Solution (Python):
a, b, c=(int(w) for w in input().split())
k=int(input())
if b>a: a, b=b, a
if c>a: a, c=c, a
print((a<<k)+b+c)

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

b = max(a)
max_sum = b * (2 ** k) + a[0] + a[1] + a[2] - b
print(max_sum)

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

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):
a,b,c = [int(i) for i in input().split()]
k = int(input())
print(max(a,b,c)*(2**k)+a+b+c-max(a,b,c))

Solution (Python):
def inpl(): return list(map(int, input().split()))
a = inpl()
K = int(input())
ans = sum(a)-max(a)
temp = max(a)
for i in range(K):
    temp *= 2
print(ans+temp)

Solution (Python):



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

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

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

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

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

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

ans = max((a, b, c)) * (2**k - 1) + sum((a, b, c))
print(ans)

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

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

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

s = sorted([A, B, C])

for k in range(K):
    s[2] *= 2

print(sum(s))

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

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

K = int(input())

print(sum(A)+(max(A)*(pow(2,K)-1)))

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

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

print(t*(2**k)+a+b+c-t)

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

a.sort(reverse=True)
for _ in range(k):
    a[0]*=2
print(sum(a))

Solution (Python):
import re
import math

if __name__ == '__main__':
    
    a, b, c = [int(x) for x in input().split()]
    k = int(input())

    ns = [a, b, c]
    ns = sorted(ns)
    for i in range(k):
        ns[2] = ns[2]*2

    print(sum(ns))

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

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

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

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

Solution (Python):
ABC = [int(_) for _ in input().split()]
K = int(input())

a, b, c = sorted(ABC)
print(a + b + c * 2 ** K)

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

print(max(l) * 2 ** n + sum(l) - max(l))

Solution (Python):
array = sorted([int(x) for x in input().split()])

k= int(input())

cnt = array[2]
for i in range(k):
    cnt *= 2

print(array[0]+ array[1] + cnt)

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

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

s = a + b + c
m = max((a, b, c))
s -= m
m <<= k
s += m
print(s)

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

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,raw_input().split())
k = input()
d = max(a,b,c)
e = a + b + c - d
for i in range(k):
    d *= 2
print e + d

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

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

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):
a, b, c = map(int, input().split())
k = int(input())

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

Solution (Python):
l = list(map(int, input().split()))
k = int(input())
m = max(l)
print(sum(l) - m + (m*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):
abc = list(map(int, input().split()))
k = int(input())
abc.sort()
print(abc[-1]*2**k+abc[0]+abc[1])

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

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):
l=[int(x) for x in input().split()]
l.sort()
k=int(input())
for i in range(k):
    l[-1]*=2
print(sum(l))

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

a, b, c = na()
k = ni()
print((max(a, b, c) << k) - max(a, b, c) + a + b + c)

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):
src = list(map(int,input().split()))
K = int(input())
src.sort()
ans = src[0]+src[1]+ src[2]*2**K
print(ans)

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

Solution (Python):

def inpl(): return map(int, input().split())
N = list(inpl())
K = int(input())
print(sum(N) + max(N)*(2**K - 1))

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

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

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

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

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

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

m = max(a, b, c)
print(a + b + c - m + (m << k))

Solution (Python):
A = sorted(map(int, raw_input().split()))
k = input()
for i in xrange(k):
    A[-1] *= 2
print sum(A)

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