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-----
5 3 11
1

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

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

x=max(a,b,c)

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


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

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

X = sorted([A, B, C])
for _ in range(K):
    X[-1] *= 2
    
print(sum(X))

def ans096(A: int, B: int, C: int, K: int):
    int_list = [A, B, C]
    int_list.sort()
    third=int_list[-1]
    for i in range(K):
        third*=2
    return int_list[0]+int_list[1]+third

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

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

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

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

import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
num_list = [int(num) for num in lines.pop(0).split(" ")]
k, = [int(num) for num in lines.pop(0).split(" ")]

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


import math
# b=input()
# c=[]
# for i in range(b):
#     c.append(a[i])
a = list(map(int,input().split()))
#b = list(map(int,input().split()))
s=int(input())

for i in range(s):
	a[a.index(max(a))]=	a[a.index(max(a))]*2
	
print(sum(a))

l = list(map(int, input().split()))
k = int(input())
num = max(l)
l.remove(num)
for i in range(k):
    num = num * 2
print(sum(l) + num)

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

M=sorted([A,B,C])
m=M[-1]

m=m*2**K

print(m+M[0]+M[1])

L = sorted(map(int, input().split()))
k = int(input())
print(L[0]+L[1]+L[2]*2**k)

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


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

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

def main():
    A = list(map(int, input().split()))
    K = int(input())
    A.sort()
    A.append(A.pop()*(2**K))
    print((sum(A)))

def __starting_point():
    main()

__starting_point()

A,B,C = map (int, input ().split ())
S = int (input ())
if A>B>C or A>C>B:
  for i in range (S):
    A = A*2
  print (A+B+C)
elif B>A>C or B>C>A:
  for i in range (S):
    B = B*2
  print (A+B+C)
else:
  for i in range (S):
    C = C*2
  print (A+B+C)

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

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

l=[int(x) for x in input().split()]
k=int(input())
m=max(l)
l.remove(max(l))
for i in range(k):
    m *= 2 
print(sum(l)+m)

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

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

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

a,b,c= sorted([a,b,c])
print((a+b+c*2**n))


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

for i in range(K):
    max_A = max(A)
    A.append(max_A * 2)
    A.remove(max_A)

print(sum(A))

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

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

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

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

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

A = list(map(int,input().split()))
K = int(input())
for _ in range(K):
  A[A.index(max(A))]*=2

print(sum(A))

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


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

n_list = [A, B, C]
x = max(n_list)
n_list.append(x * 2 ** K)
n_list.remove(x)
print(sum(n_list))

def answer(a: int, b: int, c: int, k: int) -> int:
    nums = sorted((a, b, c))
    nums[-1] = nums[-1] * 2 ** k

    return sum(nums)


def main():
    a, b, c = list(map(int, input().split()))
    k = int(input())
    print((answer(a, b, c, k)))


def __starting_point():
    main()

__starting_point()

display = sorted(list(map(int, input().split())))
K = int(input())

maximum = display[-1]
for i in range(K):
    maximum = maximum*2
# print(maximum)
# print(display[:-1])
# print(sum(display[:-1]))
print(sum(display[:-1])+maximum)

A, B, C = sorted([int(i) for i in input().split()])
K = int(input())
print((A + B + (C * (2**K))))


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

d=max(l)
e=d*(2**k)

l.remove(max(l))
l.append(e)

print((sum(l)))


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

A,B,C = map(int,input().split())
Max = max(A,B,C)
K = int(input())
Max *= 2**K
print(min((A+B+Max),(A+Max+C),(Max+B+C)))

l = list(map(int,input().split()))
n = int(input())
ls = sorted(l)
print(ls[0]+ls[1]+ls[2]*(2**n))

lst = input().split()
K = int(input())
for i in range(3):
   lst[i] = int(lst[i])

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

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

def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    a, b, c = sorted(Input())
    k = int(input())

    for i in range(k):
        c *= 2
    print(a+b+c)


main()

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

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

max_num = max(A,B,C)
if A == max_num:
  print(A * (2 ** K) + B + C)
elif B == max_num:
  print(B * (2 ** K) + A + C)
else:
  print(C * (2 ** K) + B + A)

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

N_List = list(map(int,input().split()))
N = int(input())
maxN = max(N_List)
print(sum(N_List)-maxN+maxN*(2**N))

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

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

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

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

ABC = sorted(ABC)

ret = ABC[2]
for i in range(K):
    ret = ret * 2

ret += sum(ABC[:2])

print(ret)

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

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

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


num1, num2, num3 = map(int, input().split())
count = int(input())

max_num = max(num1, max(num2, num3))

sum_num = num1 + num2 + num3 - max_num
end_num = max_num
for i in range(count):
    end_num *= 2

print(sum_num + end_num)

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

max = 0
index = -1
for i in num_list:
    if max < i:
        max = i
        index = num_list.index(i)

change = max*(2**k)
num_list[index] = change
ans = 0
for j in num_list:
    ans += j

print(ans)

A, B, C = list(map(int,input().split()))
K = int(input())
Numbers = [A,B,C]

Numbers.sort(reverse=True)

for i in range(K):
    twice = Numbers[0] * 2
    Numbers[0] = twice

print((sum(Numbers)))



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

mylists.sort(reverse=True)
print((mylists[0] * 2 ** k - mylists[0] + sum(mylists)))


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

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

l = list(map(int, input().split()))
k = int(input())
i = l.index(max(l))
m = l[i]
del l[i]
l.append(m * 2 ** k)
print((sum(l)))


n = [int(s) for s in input().split()]
k = int(input())

for i in range(k):
    max_id = n.index(max(n))
    n[max_id] *= 2
print(sum(n)) 

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


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

sum_a=sum(a)

ans=sum_a-max(a)+max(a)*2**k

print(ans)

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

A=list(map(int,input().split()))
K=int(input())
A.sort()
A[2]=A[2]*2**K
print((sum(A)))


ABC = sorted(map(int, input().split()))
K = int(input())

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


a = [int(x) for x in input().split()]
k = int(input())
print(sum(a) - max(a) + max(a) * (2 ** k))

abc = list(map(int, input().split()))
k = int(input())
mx = abc.pop(abc.index(max(abc)))
print((mx * pow(2, k) + sum(abc)))


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

#!/usr/bin/env python3


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


abc.sort()

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


#
# abc096 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5 3 11
1"""
        output = """30"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3 3 4
2"""
        output = """22"""
        self.assertIO(input, output)


def resolve():
    I = list(map(int, input().split()))
    K = int(input())

    for i in range(K):
        t = max(I)
        I.remove(t)
        I.append(t*2)

    print((sum(I)))


def __starting_point():
    # unittest.main()
    resolve()

__starting_point()

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

for i in range(K):
	C*=2

print((A+B+C))


nums = list(map(int, input().split()))
k = int(input())
x = max(nums)
mulx = x*(2**k)
print((mulx + sum(nums)-x))


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

def resolve():
    a = list(map(int, input().split()))
    k = int(input())
    a.sort()
    for i in range(k):
        a[2] = a[2] * 2
    print(sum(a))
resolve()

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

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

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

List =  list(map(int, input().split()))
K = int(input())
sort = sorted(List)
for i in range(K):
    sort[-1] = sort[-1]*2
print((sum(sort)))    


a = list(map(int, input().split()))
k = int(input())
a.sort(reverse=True)
a[0] *= 2**k
print(sum(a))

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

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

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

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

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

import heapq

val = list(map(lambda x: -int(x), input().split()))
K = int(input())

heapq.heapify(val)

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

print(-sum(val))

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

K=int(input())

A.sort(reverse=True)

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


l = list(map(int,input().split()))
n = int(input())
ls = sorted(l)
print(ls[0]+ls[1]+ls[2]*(2**n))

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

for i in range(K):
    max_A = max(A)
    A.append(max_A * 2)
    A.remove(max_A)

print(sum(A))

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

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

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


import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    ABC = LI()
    K = I()
    ABC.sort()

    ans = sum(ABC[:2]) + ABC[2] * 2 ** K
    print(ans)

def __starting_point():
    resolve()

__starting_point()

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

a.sort()

print(sum(a[:-1]) + a[-1] * 2 ** k)

m, *A = sorted([int(x) for x in input().split()], reverse=True)
K = int(input())
  
print((m * 2**K) + sum(A))

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

a, b, c = map(int, input().split())
k = int(input())
x = max(a, b, c)
if x == a:
    print(a*2**k + b + c)
elif x == b:
    print(a + b*2**k + c)
else:
    print(a + b + c*2**k)

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

for i in range(k):
  m *= 2
  
print(sum([a, b, c]) - max(a, b, c) + m)

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

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

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

a = sorted(list(map(int, input().split())))
m = a.pop()
for i in range(int(input())):
  m *= 2
print(sum(a) + m)

list_abc = sorted([int(i) for i in input().split()])
k = int(input())
print(list_abc[2] * 2 ** k + sum(list_abc[:2]))

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

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


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

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

a.sort()
a[-1] *= 2 ** k

print((sum(a)))