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

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

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

ans = 0
for i in range(3):
    ans += boad[i]
print(ans)

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

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

Solution (Python):

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

if max(A,B,C) == A:
    A = A*(2**K)
elif max(A,B,C) == B:
    B = B*(2**K)
elif max(A,B,C) == C:
    C = C*(2**K)
    
print(sum([A,B,C]))

Solution (Python):

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

n = int(input())

ans = max(a,b,c)

for i in range(n):
	ans = ans*2

print(ans+a+b+c-max(a,b,c))

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

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

print(ans)

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):
A, B, C = map(int, input().split())
K = int(input())
print((max(max(A, B), C) * (pow(2, K) - 1) + A + B + C))

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

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

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

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

for i in range(K):
	num.sort(reverse=True)
	num[0] *= 2
print(sum(num))

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

ans = a + b + c

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

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

Solution (Python):


V=list(map(int,input().split(" ")))
K=int(input())
Vs=sorted(V) 

print(Vs[2]*2**K+sum(Vs[:2]))

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

Solution (Python):
A, B, C = (int(i) for i in input().split())
K = int(input())
if A < B: A, B = B, A
if A < C: A, C = C, A
for i in range(K): A *= 2
print(A + B + C)

Solution (Python):
def examB():
    ABC = LI()
    K = I()
    ans = sum(ABC) + max(ABC)*(2**K-1)
    print(ans)


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Solution (Python):

import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = 1
count = 0

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

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

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


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

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

Solution (Python):
import numpy as np
A=  np.array(list(map(int, input().split())))
n = int(input())
f = np.argmax(A)
A[f] = A[f]*2**n
print(A.sum())

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

print(sum(A[:-1]) + A[-1] *2**n )

Solution (Python):
A,B,C=map(int,input().split())
K=int(input())
max_=max(A,B,C)
ans=A+B+C
for i in range(K):
  ans+=max_
  max_+=max_
print(ans)

Solution (Python):
nums = []
nums.extend([int(x) for x in input().split()])
mult = int(input())
maxi = max(nums)
nums.remove(maxi)
print(sum(nums) + maxi*(2**mult))

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

n = max(a,max(b,c))

if n == a:
	print((2**k)*n+b+c)
elif n == b:
	print((2**k)*n+a+c)
else:
	print((2**k)*n+a+b)

Solution (Python):


def main():
    A,B,C = map(int, input().split())
    K = int(input())
    max_val = max(A,B,C)
    baisu = 0
    for i in range(K):
        if i == 0:
            baisu = max_val * 2
        else:
            baisu = baisu * 2
    print(A+B+C - max_val + baisu)
    

if __name__ == "__main__":
    main()

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

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

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):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A, B, C = MAP()
K = INT()

tmp = sorted([A, B, C])
print(tmp[0]+tmp[1]+tmp[2]*(2**K))

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

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

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):
from sys import stdin

li = list(map(int,stdin.readline().rstrip().split()))
n = int(stdin.readline().rstrip())
li.sort()
li[2] *= 2**n
    
print(sum(li))

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

Solution (Python):

a, b, c = [int(s) for s in input().split()]
k = int(input())

sum_of_integers = a + b + c

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

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

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

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

Solution (Python):
ls=[int(s) for s in input().split()]
K=int(input())
ls.sort()
for i in range(K):
  ls[2]*=2
print(ls[0]+ls[1]+ls[2])

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

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

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

print(sum(x) + max(x) * ((1 << k) - 1))

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

res = 0
for i in range(3):
  if(i == 2):
    res += s[i] * (2 ** k)
  else:
    res += s[i]
print(res)

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

def solve(a,b,c,k):
    lst = [a,b,c]
    for i in range(k):
        ind = lst.index(max(lst))
        lst[ind] = lst [ind] * 2
    return sum(lst)




if __name__ == '__main__':
    main()

Solution (Python):

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

ans = A[0]*(2**K)+A[1]+A[2]

print(ans)

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):
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):
l = [int(num) for num in input().split()]
K = int(input())
a = max(l)
for _ in range(K):
  a = a * 2

l.sort()
l[len(l)-1] = a
print(sum(l))

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

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

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

print(sum(nums))

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

main()

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

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

print((a+b+c)-max(a, b, c)+m)

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

Solution (Python):
import sys
input = sys.stdin.readline


def main():
    A = list(map(int, input().split()))
    K = int(input())
    A.sort()
    A[-1] *= 2**K
    print(sum(A))


if __name__ == '__main__':
    main()

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

Solution (Python):


import sys










def main():
    *n, k = (int(x) for x in sys.stdin.read().split())
    n.sort()
    total = n[0] + n[1] + n[2] * 2 ** k
    print(total)


if __name__ == "__main__":
    
    main()

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a = inpl()
k = inp()
a.sort()
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(A+B+C+M*(2**K-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):
A, B, C = map(int, input().split())
K = int(input())

n = max(A,B,C)
s = n
for i in range(1,K+1):
    s = s*2

print(s+A+B+C-n)

Solution (Python):
import math
import sys
input = sys.stdin.readline


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

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

    print(ans)


if __name__ == '__main__':
    main()

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

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):
n = [int(_) for _ in input().split()]
k = int(input())

print(max(n) * (2**k - 1) + sum(n))

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

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):
A = list(map(int, input().split()))
k = int(input())
A[A.index(max(A))] *= 2 ** k

print(sum(A))

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

Solution (Python):
a = [int(i) for i in input().split()]
k = int(input())
b = max(a)
a.remove(b)
for i in range(1,k+1):
    b *= 2
a.append(b)
print(sum(a))

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

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

i=max(a,b,c)

x=i*(2**k)

print(a+b+c+x-i)

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

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

print(sum(ABC))

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

Solution (Python):



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


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

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

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

if a>=b and a>=c:
    ans = a
    cou = a
elif b>=a and b>=c:
    ans = b
    cou=b
else:
    ans = c
    cou=c
for i in range(k):
    count=ans*2
    ans = count
if cou==a:
    print(ans+b+c)
elif cou==b:
    print(ans+a+c)
else:
    print(ans+b+a)

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

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

Solution (Python):
def main(a, b, c, k):
    l = [a, b, c]
    for _ in range(k):
        l[l.index(max(l))] = max(l)*2

    print(sum(l))


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

    main(a, b, c, 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())

U=[A,B,C]
U.index(max(U))

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

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

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

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

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

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

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

M=L.index(max(L))
L[M]*=2**K

print(sum(L))

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

Solution (Python):
def main():
     A, B, C = map(int, input().split())
     K = int(input())
     v = [A, B, C]
     v.sort(reverse = True)
     return pow(2, K)*v[0] + v[1] + v[2]

if __name__ == '__main__':
    print(main())

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

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

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

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

Solution (Python):
a = list(map(int,input().split()))
k = int(input())
ans = sum(a)
m = max(a[0],a[1],a[2])
ans -= m
for _ in range(k):
    m *= 2
ans += m
print(ans)

Solution (Python):
a = list(map(int, input().split()))
n = int(input())
t = max(a)
for i in range(n):
	t*=2

ans = t + sum(a) -max(a)
print (ans)

Solution (Python):
*n, = sorted(map(int, input().split()))
k = int(input())

for _ in range(k):
    n[-1] = n[-1]*2

print(sum(n))

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

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

n[-1] = n[-1] * 2**k

print(sum(n))

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())
K = int(input())
print(max(A,B,C)*2**K + A + B + C - max(A, B, C))

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

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

ABC.sort()

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

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

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

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

hoge = max([a,b,c])
ot =a + b +c -hoge

print(ot+hoge*(2**k))

Solution (Python):
A, B, C = map(int, input().split())
K = int(input())
M = max(A,B,C)
tmp = M
for _ in range(K):
    M += M
print(A+B+C+M-tmp)

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

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

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

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

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

print(sum(number))

Solution (Python):
readints = lambda:map(int, input().split(' '))
x = list(readints())
n = int(input())
x.sort()

for _ in range(n):
  x[-1] = x[-1] * 2
  
print(sum(x))

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

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

s = sorted([a,b,c],reverse=True)
print(s[0]*(2**k)+s[1]+s[2])

Solution (Python):
A=[int(x) for x in input().split()]
N=int(input())

t=max(A)
for i in range(N):
	t*=2

print(sum(A)+t-max(A))

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

Solution (Python):
abc = sorted(map(int, input().split()))[::-1]
K = int(input())

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

print(sum(abc))

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

M = max(l)
l.remove(M)
print(sum(l) + M * 2**K)

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

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

Solution (Python):
import heapq
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    l = [-int(x) for x in input().split()]
    heapq.heapify(l)
    k = int(input())

    for _ in range(k):
        a = heapq.heappop(l) * 2
        heapq.heappush(l, a)

    ans = 0
    for x in l:
        ans += -x
    print(ans)


if __name__ == '__main__':
    main()

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

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

print(sum(l))

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    v = sorted(map(int, input().split()))
    k = int(input())
    print(sum(v[:-1]) + v[-1] * 2 ** k)


if __name__ == "__main__":
    main()

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

x = max(a, b, c)
x2 = x

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

print(a+b+c+x2-x)

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

a=sorted(a,reverse=True)

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    abc = list(map(int, input().rstrip('\n').split()))
    abc.sort()
    k = int(input().rstrip('\n'))
    for i in range(k):
        abc[-1] *= 2
    print(sum(abc))


if __name__ == '__main__':
    slove()

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())
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())
print(max([A, B, C]) * (2 ** K) + sum([A, B, C]) - max([A, B, C]))

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

Nums[-1] = Nums[-1] * (2 ** k)
print(sum(Nums))

Solution (Python):
A,B,C,K = map(int,open(0).read().split())
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())
a.sort(reverse=True)
a[0] = (a[0]*(2**k))
print(sum(a))

Solution (Python):
A= [int(x) for x in input().split()]
K = int(input())
ma = max(A)
mb = ma*2**K
print(sum(A)-ma+mb)

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

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

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

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

    while k > 0:
        abc.sort()
        abc[-1] = abc[-1]*2
        k -= 1

    print(sum(abc))

bb096()

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

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

max_num = max(num_list)
print(sum(num_list) - max_num + (max_num * (2 ** K)))

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

print(sum(a[0:2]) + a[2]*2**int(input()))

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(A+B+C+max(A,B,C)*(2**K-1))

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

print(sum(a))

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

Solution (Python):
import heapq
A = list(map(int, input().split()))
A = [-a for a in A]
K = int(input())
heapq.heapify(A)
for i in range(K):
    max_val = heapq.heappop(A)
    heapq.heappush(A, 2*max_val)

print(sum([-a for a in A]))

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

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

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

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

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

print(R+M)

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

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

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

main()

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

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    a,b,c=map(int,input().split())
    k=int(input())
    print((2**k-1)*max(a,b,c)+a+b+c)
resolve()

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

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

Solution (Python):
ABC = list(map(int, input().split()))
ABC.sort(reverse=True)

K = int(input())

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

print(sum(ABC))

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

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

max_i = max(range(len(num_list)), key=lambda x: num_list[x])

num_list[max_i] *= 2 ** k
print(sum(num_list))

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

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

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

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

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

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

Solution (Python):
A, B, C = list(map(int, input().split()))
K = int(input())
for i in range(K):
    max_val = max(A, B, C)
    if max_val == A:
        A *= 2
    elif max_val == B:
        B *= 2
    elif max_val == C:
        C *= 2
print(sum([A, B, C]))

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)*(2**K-1))

Solution (Python):

def main():
    A, B, C = sorted(map(int, input().split()), reverse=1)
    K = int(input())
    ans = A * 2 ** K + B + C
    print(ans)


if __name__ == "__main__":
    main()

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

print(sum(abc))

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

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

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

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

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

Solution (Python):
import sys
from functools import reduce
import copy
import math


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    values = string_to_int(inputs[0])
    K = int(inputs[1])
    values.sort()
    max_v = values.pop()
    for _ in range(K):
        max_v *= 2
    r = sum(values)
    return r + max_v


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)

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

print(sum(a)+max(a)*(2**k-1))

Solution (Python):

def main():
	line = input()
	vector = [int(x) for x in line.split()]
	maxim = max(vector)
	k = int(input())
	sum = 0
	used = 0
	for i in range(3):
		if vector[i] == maxim and used == 0:
			sum += vector[i] * 2 ** k
			used = 1
		else:
			sum += vector[i]
	print(sum)
 
 
 
if __name__ == "__main__":
	main()

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

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

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

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

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

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

l.sort()
l[2] = l[2]*(2**k)

print(sum(l))

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

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

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

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

Solution (Python):


def main():


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






if __name__== "__main__":
    main()

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

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