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

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

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

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

K = int(input())

num = 0
ans = A+B+C
while True:
    num += 1
    ans += max(A,B,C)*(2**(num-1))
    if num == K:
        break

print(ans)

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

Solution (Python):
import sys
array_abc = list(map(int,input().split()))
K = int(input())

if not ( 1 <= min(array_abc),max(array_abc) <= 50 ):
    sys.exit()
if not ( 1 <= K <= 10 ):
    sys.exit()

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

Solution (Python):
import sys
array_abc = list(map(int,input().split()))
K = int(input())

if not ( 1 <= min(array_abc),max(array_abc) <= 50 ):
    sys.exit()
if not ( 1 <= K <= 10 ):
    sys.exit()

option = max(array_abc)
for I in range(K):
    option = option * 2

print(sum(array_abc) + option - max(array_abc))

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

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

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

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

Solution (Python):
l = list(map(int, input().split()))
k = int(input())
mx = max(l)
ans = sum(l) - mx
for _ in range(k):
    mx *= 2

print(ans+mx)

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):
import sys
def input(): return sys.stdin.readline().strip()


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

    def dfs(k):
        if k == 0: return sum(A)
        A[0] *= 2
        cand1 = dfs(k - 1)
        A[0] //= 2
        A[1] *= 2
        cand2 = dfs(k - 1)
        A[1] //= 2
        A[2] *= 2
        cand3 = dfs(k - 1)
        A[2] //= 2
        return max(cand1, cand2, cand3)

    print(dfs(K))

if __name__ == "__main__":
    main()

Solution (Python):
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    num_list = i_list()
    k = i_input()

    num_list.sort()

    count = 0
    for i in range(3):
        if i == 2:
            tmp = num_list[2]
            for j in range(k):
                tmp *= 2
            count += tmp
        else:
            count += num_list[i]

    print(count)

if __name__ == '__main__':
    main()

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

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

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

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

for i in range(K):
  x = a.index(max(a))
  a[x] *= 2
  i += 1
  
print(sum(a))

Solution (Python):
a,b,c=map(int,input().split())
k=int(input())
for _ in range(k):
    m=max(a,b,c)
    if m==a:
        a*=2
    elif m==b:
        b*=2
    else:
        c*=2
print(sum([a,b,c]))

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

Solution (Python):
def actual(a, b, c, k):
    
    max_num = max((a, b, c))
    repetition = (2 ** k - 1)
    
    return a + b + c + (max_num * repetition)

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

print(actual(a, b, c, k))

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

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

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

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

Solution (Python):
a=sorted(map(int,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())
L = sorted([a, b, c])
print(L[0] + L[1] + L[2]*2**k)

Solution (Python):
import sys, os, math, bisect, itertools, collections, heapq, queue

from decimal import Decimal
from collections import defaultdict



sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)


MOD = 10 ** 9 + 7
MAX = float('inf')


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

    ABC = sorted(il())
    mx = max(ABC)
    K = ii()

    for k in range(K):
        mx *= 2
    print(ABC[0] + ABC[1] + mx)


if __name__ == '__main__':
    main()

Solution (Python):
import sys

input = sys.stdin.readline


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

    max_v = max(A, B, C)

    ans = sum((A, B, C)) - max_v + max_v * 2 ** K
    print(ans)


if __name__ == "__main__":
    main()

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

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

mt = max(lis)

a = sum(lis)-mt

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

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

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

A,B,C = I()
K = i()
m = max(A,B,C)
ans = A+B+C+m*(2**K-1)
print(ans)

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

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



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

print(total+mx)

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

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

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

abc.sort()
print(abc[0]+abc[1]+abc[2]*pow(2,k))

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

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

Solution (Python):

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


for c in range(K):
    max_num = max(numbers)
    max_idx = numbers.index(max_num)
    numbers[max_idx] *= 2

print(sum(numbers))

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

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):
ABC=list(map(int,input().split()))
K=int(input())
ABC.sort()
ABC[2]*=2**K
print(sum(ABC))

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

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

Solution (Python):
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))

Solution (Python):
*a,b=map(int,open(0).read().split());print(sum(a)+max(a)*(2**b-1))

Solution (Python):
if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    n = int(input())
    a.sort()
    a[2] = a[2]*(2**n)
    print(sum(a))

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

l=[a,b,c]
l=sorted(l,reverse=True)

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

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

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

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

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

for i in range(3):
  if a[i] == tmp:
    a[i] = m
    break
  
print(sum(a))

Solution (Python):

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A = lr()
K = ir()
A.sort()
answer = sum(A[:2])
answer += pow(2, K) * A[2]
print(answer)

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

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

print(sum(abc))

Solution (Python):
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a=nl()
k=ni()

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

print(sum(a))

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())
for _ in range(K):
    if A == max(A, B, C):
        A *= 2
    elif B == max(A, B, C):
        B *= 2
    else:
        C *= 2
print(sum([A, B, C]))

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

idx = l.index(max(l))
l[idx] = pow(2, K) * l[idx]
print(sum(l))

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

for i in range(k):
    idx = a.index(max(a[0], a[1], a[2]))
    a[idx] *= 2
print(sum(a))

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

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

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

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

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

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

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

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

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

Solution (Python):
def main():
    ABC = list(map(int, input().split()))
    K = int(input())
    ABC.sort()
    m = ABC.pop()
    mK = m*(2**K)
    ans = sum(ABC) + mK
    print(ans)

if __name__ == "__main__":
    main()

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

Solution (Python):
a=list(map(int,input().split()))
n=int(input())
x=max(a)*(2**n)
print(x+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):
xs = [int(i) for i in input().split()]
k = int(input())

x = max(xs)
ans = x * (2**k) + sum(xs) - x

print(ans)

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

ans=max(b)*2**n+sum(b)-max(b)
print(ans)

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

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

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

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

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

Max = max(abc)
for i in range(0,k):
  Max = Max * 2

Sum = sum(abc) - max(abc) + Max
print(Sum)

Solution (Python):
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))

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())
ans = 0
a.sort()
a[2] = a[2]*2**k
for i in range(3):
    ans += a[i]
print(ans)

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

for i in range(3):
    array[i][i] *= 2**K

print(max(sum(array[0]),sum(array[1]),sum(array[2])))

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

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

Solution (Python):
a=sorted(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

sys.setrecursionlimit(10000000)
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue



ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)


MOD = 10 ** 9 + 7
MAX = float('inf')


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

    NUM = sorted(il(), reverse=True)
    K = ii()
    mx = max(NUM)
    sm = sum(NUM[1:])
    for i in range(K):
        mx *= 2
    print(sm+mx)


if __name__ == '__main__':
    main()

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    a, b, c = mi()
    k = ii()
    print(a + b + c + (pow(2, k) - 1) * max(a, b, c))


if __name__ == "__main__":
    main()

Solution (Python):
arr = []

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

arr.append(A)
arr.append(B)
arr.append(C)

arr = sorted(arr)
for i in range(0,K):
  arr[2]=2*arr[2]
print(sum(arr))

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

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

Solution (Python):
import sys
import heapq

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

    heap = [-A, -B, -C]
    heapq.heapify(heap)
    for _ in range(K):
        max = heapq.heappop(heap)
        heapq.heappush(heap, max * 2)
    
    sum = 0
    for i in heap:
        sum += i
    print(-sum)

if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

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

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

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

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

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

print(sum(l))

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def Yes(): print("Yes"); return
def No(): print("No"); return


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


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


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def Base_10_to_n(X, n):
  if (int(X/n)):
    return Base_10_to_n(int(X/n), n)+[X%n]
  return [X%n]






A = inputIL()
K = inputI()

S = sum(A)
M = max(A)

print(S-M+M*2**K)

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

if __name__ == '__main__':
    main()

Solution (Python):
import math,numpy, collections

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

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

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

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

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())
k=int(input())

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

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

Solution (Python):

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left 
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pri = lambda x: print(*x, sep='\n')

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

L.sort()
val = L[0] + L[1] + L[2]*pow(2, K)
print(val)

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


ans=0
for i1 in range(k+1):
    for i2 in range(k+1):
        for i3 in range(k+1):

            if (i1+i2+i3==k):
                temp=a*2**(i1)+b*2**(i2)+c*2**(i3)

                ans=max(ans,temp)

print(ans)

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

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

Solution (Python):
def resolve():
	nums = list(map(int, input().split()))
	k = int(input())
	ans = 0
	for i in range(k):
		m = 0
		for j in range(1, 3):
			if nums[m] < nums[j]:
				m = j
		nums[m] *= 2
	print(sum(nums))
resolve()

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

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]





S = sorted(li())
K = ii()

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

A,B,C=LI()
K=II()

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

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

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

maxABC = max(array)
maxIndex = array.index(maxABC)
array.pop(maxIndex)

print(sum(array) + maxABC * 2**K)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

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

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

Solution (Python):

"""
Created on Wed May 13 17:23:47 2020

@author: shinba
"""

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

A.sort()

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

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

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

print(sum(A))

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

def main():
    A = list(map(int, input().split()))
    A.sort()
    for _ in range(int(input())):
        A[-1] <<= 1
    print(sum(A))

if __name__ == "__main__":
    main()

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

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

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

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

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())
while k>0:
    if max(a,b,c)==c:
        c=2*c
        k-=1
    elif max(a,b,c)==b:
        b=2*b
        k-=1
    else:
        a=2*a
        k-=1
print(sum([a,b,c]))

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

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

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

max_sum = max(num_list)*2**K + sum(num_list) - max(num_list)

print(max_sum)

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

am = max(a)
mp = a.index(am)

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

a[mp] = am
print(sum(a))

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

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

Solution (Python):
import sys
import math

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

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

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

print(sum(N))

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

m = 0
max_i = -1
for i,a in enumerate(As):
  if m < a:
    m = a
    max_i = i
    
for i in range(K):
  As[max_i] *= 2
  
print(sum(As))

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

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

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