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):
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):
l = list(map(int, input().split()))
k = int(input())

l.sort()

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

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

Solution (Python):

import sys


def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

lst = sorted(ILI())
K = II()
ans = lst[-1]*2**K + sum(lst[:-1])
print(ans)

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

li = [a, b, c]
li.sort()

print(li[0] + li[1] + li[2] * 2 ** k)

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

M       = max(A, B, C)

print(A+B+M*(2**K) if M==C else A+M*(2**K)+C if M==B else M*(2**K)+B+C)

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

max_abc = ABC_LIST[-1]

ans = ((2**K) * max_abc) + sum(ABC_LIST[:2])

print(ans)

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

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

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

tmp = a+b+c - max([a, b, c])
print(tmp + max([a, b, c]) * pow(2, K))

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

Solution (Python):
import sys
import math
from fractions import gcd





def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""


 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


l = list(map(int, sys.stdin.readline().split()))
K =  int(sys.stdin.readline())

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

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

print(a + b + c * (1 << k))

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

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

Solution (Python):
A, B, C = map(int, input().split())
K = int(input())
m = max(A,B,C)
print(A+B+C-m+m*(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):
import sys
input = sys.stdin.readline
a,b,c=map(int,input().split())
k=int(input())

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

Solution (Python):
import sys

stdin = sys.stdin

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

li = na()
k = ni()
print(sum(li) - max(li) + max(li) * (2 ** k))

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

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

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

Solution (Python):
l,k=open(0);l=list(map(int,l.split()));print(sum(l)+max(l)*(2**int(k)-1))

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


if __name__ == "__main__":
    test()

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

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


max_num = max(abc)
abc.remove(max_num)
print(sum(abc) + max_num * 2 ** (k))

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

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

Solution (Python):
a,b,c = map(int,input().split())
k = int(input())
ans = 0
for i in range(k+1):
    for j in range(k+1-i):
        n = k - (i + j)
        res = a * 2 ** i + b * 2 ** j + c * 2 ** n
        ans = max(ans,res)
print(ans)

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):
abc = sorted(list(map(int, input().split())))
k = int(input())

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

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):
def resolve():
    abc = list(map(int, input().split()))
    n = int(input())
    ans = max(abc) * 2 ** n + sum(abc) - max(abc)
    print(ans)


if __name__ == "__main__":
    resolve()

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

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

Solution (Python):
n = sorted(list(map(int, input().split())), reverse=True)
k = int(input())

for i in range(k):
    t = n.pop(0)
    n.append(t*2)
    n = sorted(n, reverse=True)
    
print(sum(n))

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

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

Solution (Python):
import heapq
def main():
    A, B, C = map(int, input().split())
    K = int(input())
    lv = []
    heapq.heappush(lv, -A)
    heapq.heappush(lv, -B)
    heapq.heappush(lv, -C)

    for _ in range(K):
        v = heapq.heappop(lv)
        heapq.heappush(lv, v*2)

    return -sum(lv)
    
if __name__ == '__main__':
    print(main())

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

Solution (Python):
A=sorted([int(i)for i in input().split()])
k=int(input())
print(A[0]+A[1]+A[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()),reverse=True)
print(2**int(input())*a+b+c)

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

for i in range(K):
    max_index = ABC.index(max(ABC))
    ABC[max_index] *= 2

print(sum(ABC))

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

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

Solution (Python):
if __name__ == '__main__':
    abc = list(map(int, input().split()))
    K = int(input())
    for _ in range(K):
        abc_sorted = sorted(abc, reverse=True)
        for num in abc_sorted:
            
                abc[abc.index(num)] = num*2
                break
    print(sum(abc))

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):
abc=list(map(int, input().split()))
k=int(input())

max_num=max(abc)

print(sum(abc)-max(abc)+max_num*(2**k))

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

max_num=max(abc)
for _ in range(k):
    max_num*=2

print(sum(abc)-max(abc)+max_num)

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

Solution (Python):
a,b,c,k=map(int,open(0).read().split())

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

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

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

if max(a, b, c ) == a:
    print(a * 2**k + b + c)
elif max(a, b, c) == b:
    print(a + b * 2**k + c)
elif max(a, b, c) == c:
    print(a + b + c * 2**k)

Solution (Python):

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

ans = 0
for i in range(k):
    ptn = [
        A[0]*2+A[1]+A[2],
        A[0]+A[1]*2+A[2],
        A[0]+A[1]+A[2]*2,
    ]
    idx = ptn.index(max(ptn))
    A[idx] *= 2

    ans = max(ptn)

print(ans)

Solution (Python):

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

ans = 0
for i in range(k):
    ptn = [
        A[0]*2+A[1]+A[2],
        A[0]+A[1]*2+A[2],
        A[0]+A[1]+A[2]*2,
    ]
    idx = ptn.index(max(ptn))
    if idx == 0:
        A = [A[0]*2, A[1], A[2]]
    elif idx == 1:
        A = [A[0], A[1]*2, A[2]]
    else:
        A = [A[0], A[1], A[2]*2]

    ans = max(ptn)

print(ans)

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

ans = sum(A) - max(A) + max(A) * 2**K
print(ans)

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

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

Solution (Python):
li = list(map(int, input().split()))
m = 0
for i, j in enumerate(sorted(li)[::-1]):
    if i == 0:
        m += j * 2 ** int(input())
    else:
        m += j
print(m)

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

abc.sort()
mx=abc.pop()*2**k
print(sum(abc)+mx)

Solution (Python):
a,b,c=input().split()
a,b,c=int(a),int(b),int(c)
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())
print(a+b+c+max(a,b,c)*(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())
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())

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

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

    A[A.index(max(A))] = max(A) * 2 ** K

    print(sum(A))

    


main()

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

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

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 = list(map(int, input().split()))
K = int(input())
B = sorted(A)
B[2]= B[2]*(2**K)
print(B[0]+B[1]+B[2])

Solution (Python):
val = input()
val = [int(x.strip()) for x in val.split(" ")]
k = int(input())
A = val[0]
B = val[1]
C = val[2]
ans = sum(val)
D = ((A if A > B else B) if (A if A > B else B) > C else C)
ans -= D
ans += D * 2 ** k
print(ans)

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

Solution (Python):
D = list(map(int, input().split()))
K = int(input())
mx =D.index(max(D))
for i in range(K):
    D[mx]=D[mx]*2

print(sum(D))

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

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

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

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

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

print(sum(num)-max(num)+max(num)*2**int(input()))

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

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

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

for i in range(k):
    max_i = nums.index(max(nums))
    nums[max_i] = nums[max_i] * 2

print(sum(nums))

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

A.sort()
for k 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 + m*2**k)

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

saidai = max(A,B,C)

if saidai == A:
    print(A * 2 ** K + B + C)
elif saidai == B:
    print(B * 2 ** K + A + C)
elif saidai == C:
    print(C * 2 ** K + A + B)

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

m = max(A, B, C)
print(sum([A, B, C]) - m + m * (2 ** K))

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

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

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

As[-1] = As[-1]*2**(K)
print(sum(As))

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

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

Solution (Python):
A,B,C = sorted(list(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())

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

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

a = sorted(a, reverse=True)

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

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

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())
for i in range(k):
	if a>=b and a>=c:
		a*=2
	elif b>=c and b>=a:
		b*=2
	else:
		c*=2
print(a+b+c)

Solution (Python):
abc = list(map(int,input().split()))
k = int(input())
s_abc = sorted(abc)
for x in range(k):
  s_abc[-1] = s_abc[-1]*2
print(sum(s_abc))

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



ans = []
ABC.sort()

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

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

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

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

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

ans = max(ABC) * (2**K-1) + sum(ABC)

print(ans)

Solution (Python):
*l,k=map(int,open(0).read().split());print(sum(l)+max(l)*~-2**k)

Solution (Python):

X = [int(el) for el in input().split(' ')]
k = int(input())

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

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

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 >= a and b >= c:
	print(b * 2 ** k + a + c)
else:
	print(c * 2 ** k + b + a)

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

a = A * 2 ** K + B + C
b = A + B * 2 ** K + C
c = A + B + C * 2 ** K
print(max(a,b,c))

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

s = li.index(max(li))

for i in range(k):
    li[s] *= 2
    
print(sum(li))

Solution (Python):

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

D = max(A, B, C)
for i in range(K):
    D *= 2

ans = A+B+C+D - max(A,B,C)
print(ans)

Solution (Python):
a,b,c = map(int,input().split())
k = int(input())
num = [a,b,c]
while k > 0:
    num[num.index(max(num))] = max(num)*2
    k -= 1
print(sum(num))

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):
import math




ls = list(map(int,input().split(" ")))




k = int(input())

maxnum = max(ls)
ls.remove(maxnum)
for i in range(k):
  maxnum = maxnum * 2
print(sum(ls) + maxnum)

Solution (Python):

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


def pow(x,k):
    return x * pow(x, k - 1) if k > 0 else 1

print(a+b+c*pow(2,k))

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

s = sum([a, b, c])

m = max([a, b, c])

print(m * 2 ** K + s - m)

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

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

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

editlist = [A, B, C]
editlist.sort(reverse=True)

for i in range(K):
    editlist[0] = editlist[0] * 2
ans = 0
for i in editlist:
    ans += i
print(ans)

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

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

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

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

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

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007


def A():
    a, b = LI()
    if a <= b:
        print(a)
    else:
        print(a-1)
    return


def B():
    a, b, c = LI()
    k = II()
    print(a + b + c + max(a, b, c) * ((2 ** k) - 1))
    return


def C():
    return


def D():
    n = II()
    ans = []
    sosu = [2]
    i = 2
    while len(ans) != n:
        for k in sosu:
            if i % k == 0:
                i += 1
                break
        else:
            sosu.append(i)
            if i % 5 == 1:
                ans.append(i)
            i += 1
    for i in ans:
        print(i, end=" ")
    print()
    return



if __name__ == '__main__':
    B()

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())

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(a + b + c + max((a, b, c)) * (2 ** k)  - max((a, b, c)))

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

Solution (Python):



s = list(map(int, input().split()))
K = int(input())
max_index = s.index(max(s))

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

print(sum(s))

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):
a = list(map(int,input().split()))
k = int(input())
print(sum(a)-max(a)+max(a)*(2**(k)))

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

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

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

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):
n = sorted(list(map(int,input().split())))
k = int(input())
print(n[2]*2**k+n[1]+n[0])

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

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

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

Solution (Python):
A, B, C = map(int, input().split())
K = int(input())
mx = max(A, B, C)
moto = A+B+C-mx
print(moto+mx*(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):
ABC = list(map(int, input().split()))
ABC.sort()
K = int(input())
print(ABC[0]+ABC[1]+ABC[2]*(2**K))

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

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

Solution (Python):

import time
import re
import math
import fractions

def main():
    A=list(map(int,input().split()))
    K=int(input())
    A.sort(key=lambda x:-x)
    print(sum(A)-A[0]+A[0]*(2**K))
start=time.time()
main()

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

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

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

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

print(ans)

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

max_num = max(abc)
abc.remove(max_num)

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

print(max_num + sum(abc))

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

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

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

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

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

Solution (Python):
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    l = list(map(int, input().split()))
    k = int(input())

    max = max(l)

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

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):
nums=list(map(int,input().split()))
k=int(input())

ans=sorted(nums,reverse=True)

for i in range(k):
    ans[0]=ans[0]*2

print(sum(ans))

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

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

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

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

l.sort()
    
max_sum = l[0]+l[1]+l[2]*(2**k)
print(max_sum)

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

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

print(sum(A) + (max(A) * 2 ** K) - max(A))

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

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

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

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

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

max_num = max([A, B, C])
sum = A + B + C - max_num

for i in range(K):
    max_num *= 2
sum += max_num

print(sum)

Solution (Python):
lst = sorted(list(map(int,input().split())),reverse=True)
n = int(input())
ans=lst[0]*2**n+sum(lst[1:])
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):
abc = list(map(int, input().split()))
k = int(input())

x = max(abc)
total = sum(abc) - x + (x * (2 ** k))

print(total)

Solution (Python):
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

A, B, C = nl()
K = n()

nums = sorted([A, B, C])
for i in range(K):
    nums[2] *= 2

print(sum(nums))

Solution (Python):

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

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

print (ans)

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

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

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

Solution (Python):
vals = sorted(list(map(int, input().split())))
k = int(input())
m = vals.pop()

print(sum(vals) + m * (2 ** k))

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

L.sort(reverse=True)
m=L[0]*(2**k)
ans=sum(L[1:])+m

print(ans)

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

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

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

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

print(sum(a))

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):
def abc():
    l = sorted(map(int, input().split()))
    n = int(input())
    l[-1] = l[-1] * (2 ** n)
    print(sum(l))


abc()

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

for i in range(k):
    m = max(lst)
    ind = lst.index(m)
    mm = m * 2
    lst[ind] = mm

print(sum(lst))

Solution (Python):
A = list(map(int,input().split(" ")))
K = int(input())
tmp = max(A)
for i in range(K):
    tmp = tmp*2
print(sum(A)+tmp-max(A))

Solution (Python):


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

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

    answer = -1
    for i in range(k):
        if a == max(a,b,c):
            a = 2*a
        elif b == max(a,b,c):
            b = 2*b
        elif c == max(a,b,c):
            c = 2*c

    answer = a + b + c
    print(answer)

Solution (Python):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")













ABC = list(map(int, sys.stdin.readline().split()))
K = int(sys.stdin.readline())

print(max(ABC) * 2 ** K + sum(ABC)- max(ABC))

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

Solution (Python):
ABC = [int(abc) for abc in input().split()]
K = int(input())
ABC.sort()
ans = ABC[0] + ABC[1] + ABC[2] * (2**K)
print(ans)

Solution (Python):
A,B,C=sorted(list(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())
print(max(A, B, C) * (2 ** K - 1) + A + B + C)

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

answer = a+b+c + (2**n-1)*x
print(answer)

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

Solution (Python):
r=list(map(int,input().split()))
k=int(input())
l=max(r)
print(sum(r)-l+l*(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([ int(v) for v in input().split() ])
k = int(input())
print(a+b+c*(2**k))

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

l = [a,b,c]
l = sorted(l, reverse=True)
for i in range(k):
    l[0] = l[0] * 2

print(sum(l))

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

abc.sort()

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

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

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