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

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

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

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

K = int(input())

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

sum = 0    
for j in N : 
    sum += j
    
print(sum)

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

max_n = max(a, b, c)
if max_n == c:
    rem = [a, b]
elif max_n == b:
    rem = [a, c]
else:
    rem = [b, c]
for _ in range(k):
    max_n *= 2
print(sum(rem) + max_n)

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

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

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):
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=input().split()
k=int(input())
a=int(A)
b=int(B)
c=int(C)
if a>=b:
  if a>=c:
    a=a*(2**k)
    print(a+b+c)
  else:
    c=c*(2**k)
    print(a+b+c)
else:
  if b>=c:
    b=b*(2**k)
    print(a+b+c)
  else:
    c=c*(2**k)
    print(a+b+c)

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

Solution (Python):
A=list(map(int,input().split()))
A.sort()
z=int(input())
k=max(A)
for i in range(1,z+1):
    k=k*2
A.pop(len(A)-1)
A.append(k)
print(sum(A))

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

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

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

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

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

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

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

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

Solution (Python):
li = [int(_) for _ in input().split()]
k = int(input())
print(li[0]+li[1]+li[2]-max(li)+max(li)*2**k)

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

index = l.index(max(l))
l[index] = l[index] * 2**k
print(sum(l))

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

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-i+1):
        ans=max(ans,A*pow(2,i)+B*pow(2,j)+C*pow(2,K-i-j))
print(ans)

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

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

m = max(abc)

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

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

Solution (Python):

import sys


def solve(A: int, B: int, C: int, K: int):
    L = [A,B,C]
    L.sort()

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



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    K = int(next(tokens))  
    solve(A, B, C, K)

if __name__ == '__main__':
    main()

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

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

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

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

arr.sort()

print(sum(arr[:2]) + arr[2] * 2 ** k)

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

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


l.sort()


for i in range(K):
  l[-1]*=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):
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())
n = [a,b,c]
n.sort()
res = n[0] + n[1] + n[2] * pow(2,k)
print(res)

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

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

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

Solution (Python):
number = list(map(int,input().split()))
K = int(input())
sum = 0
times = 0

while True:
    large_number = max(number)
    number.remove(large_number)
    number.append(large_number*2)
    times += 1
    if times == K:
        break
for i in range(3):
    sum += number[i]
print(sum)

Solution (Python):
abc = list(map(int, input().split()))
n = int(input())
maxAbc = max(abc)
abc.pop(abc.index(max(abc)))

for i in range(n):
    maxAbc *= 2
    
print(sum(abc) + maxAbc)

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

K = int(input())

ABC.sort(reverse=True)

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

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

Solution (Python):

import sys


def solve(A: int, B: int, C: int, K: int):
    mx = max(A, B, C)
    ret = mx * (2 ** K) + A + B + C - mx
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    K = int(next(tokens))  
    solve(A, B, C, K)

if __name__ == '__main__':
    main()

Solution (Python):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


class UnionFind:

    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def root(self, i):
        if (self.parent[i] == i):
            return i
        self.parent[i] = self.root(self.parent[i])
        return self.parent[i]

    def unite(self, i, j):
        rooti = self.root(i)
        rootj = self.root(j)
        if rooti == rootj:
            return
        if i < j:
            self.parent[rootj] = rooti
        else:
            self.parent[rooti] = rootj

    def same(self, i, j):
        return self.root(i) == self.root(j)





def main():
    a, b, c = intin()
    k = intin()

    m = max(a, b, c)

    mm = m*(2**k)

    if m == a:
        print(mm + b + c)
    elif m == b:
        print(a + mm + c)
    elif m == c:
        print(a + b + mm)


if __name__ == '__main__':
    main()

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

print(max_num*2**k + sum(a))

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

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

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

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

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

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

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

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

def dfs(i,a,b,c):
    if i == K:
        return A*(2**a)+B*(2**b)+C*(2**c)
    res1 = dfs(i+1,a+1,b,c)
    res2 = dfs(i+1,a,b+1,c)
    res3 = dfs(i+1,a,b,c+1)
    return max(res1,res2,res3)

print(dfs(0,0,0,0))

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:
        B*=2
    else:
        C*=2
print(A+B+C)

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

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

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

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

Solution (Python):
import math

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

ls = [A,B,C]

ls.sort()

print(int(ls[0] + ls[1] + (ls[2]*math.pow(2,K))))

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

a = sorted(a)
print(a[0]+a[1]+a[2]*(2**n))

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

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

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

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a = f()
    k = f()[0]
    print(sum(a) + max(a)*2**k - max(a))

solve()

Solution (Python):
board=[int(i) for i in input().split()]
K=int(input())
for i in range(K):
    a=board.index(max(board))
    board[a]*=2
print(sum(board))

Solution (Python):



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


if __name__ == '__main__':
    main()

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

ABC.sort(reverse=True)

print(sum([ABC[0]*2**K, ABC[1], ABC[2]]))

Solution (Python):

import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(A: int, B: int, C: int, K: int):
    ss = sorted([A, B, C])
    return ss[0] + ss[1] + ss[2] * 2 ** K


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    K = int(next(tokens))  
    result = solve(A, B, C, K)
    if isinstance(result, Iterable):
        result = '\n'.join([str(v) for v in result])
    print(result)

if __name__ == '__main__':
    main()

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

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

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

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

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

Solution (Python):
import sys
import math

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

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

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

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

Solution (Python):
def main():
  nums = [int(x) for x in input().split()]
  N = int(input())
  print(sum(nums) + max(nums) * (2**N - 1))


if __name__ == "__main__":
  main()

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

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

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

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

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

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

ABC.sort()
for _ in range(K):
    ABC[2] = ABC[2]*2
print(ABC[0]+ABC[1]+ABC[2])

Solution (Python):

def read_input():
    a, b, c = map(int, input().split())
    k = int(input())
    return a, b, c, k


def submit():
    a, b, c, k = read_input()

    target = max(a, b, c)
    rest = a + b + c - target

    for i in range(1, k+1):
        target *= 2

    print(rest + target)


if __name__ == '__main__':
    submit()

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

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

Solution (Python):

import numpy as np
import math
import re

n = input()
n = re.split(" ",n)
n = list(map(int,n))
m = max(n)
a = int(n[0])
b = int(n[1])
c = int(n[2])
k = int(input())
if(m == a):
    print(b + c + m*2**k)
elif(m == b):
    print(a + c + m*2**k)
elif(m == c):
    print(a + b + m*2**k)

Solution (Python):
A = [int(x) for x in 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(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())
x = max(a,b,c)
print(x*(2**k) + a + b + c - x)

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

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

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

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

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

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

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

print(sum(X))

Solution (Python):
import sys
from collections import Counter

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

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

print(sum(abc_list))

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

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

d=[]
d.append(A)
d.append(B)
d.append(C)

maxc=max(d)
max = max(d)

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

print(max+A+B+C-maxc)

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

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

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

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

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

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

print(sum(a))

Solution (Python):


a, b, c = sorted(list(map(int, input().rstrip().split())), reverse=True)
k = int(input())
print(a * 2 ** k + b + c)

Solution (Python):

a, b, c = sorted(list(map(int, input().rstrip().split())), reverse=True)
k = int(input())
if k == 1:
    print(a * 2 + b + c)
else:
    for i in range(1, k + 1):
        A = a * 2 + b + c
        B = a + b * 2 ++ c
        C = a + b + c * 2
        if max(A, B, C) == A:
            a *= 2
        elif max(A, B, C) == B:
            b *= 2
        else:
            c *= 2
    print(a + b + c)

Solution (Python):
def main():
	A, B, C = map(int,input().split())
	K = int(input())
	init_max = max(A,B,C)
	init_sum = A+B+C
	mul = 2**K
	ans = init_max*(mul-1)+init_sum
	print(ans)


if __name__ == '__main__':
	main()

Solution (Python):
A = sorted(list(map(int, input().split())))[:: -1]
K = int(input())
for _ in range(K):
	A[0] = 2 * max(A)
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())
K = int(input())
x = max(A,B,C)
ans = A+B+C+x*(2**K-1)
print(ans)

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

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

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

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

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

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

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

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

print(a + b + c)

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

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

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

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):
N = sorted(map(int, input().split()))
K = int(input())

print(sum([N[0], N[1], N[2] * (2 ** K)]))

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

Solution (Python):

import sys
INF = float("inf")


def solve(A: int, B: int, C: int, K: int):
    a = sorted([A, B, C])
    print(a[0]+a[1]+a[2]*(2**K))

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    K = int(next(tokens))  
    solve(A, B, C, K)


if __name__ == '__main__':
    main()

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

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

sum += m
print(sum)

Solution (Python):

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

N = int(input())

li.sort(reverse = True)

for i in range(N):
    li[0] = li[0] * 2

print(sum(li))

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

N.sort()
N[2] = N[2] * 2**K
print(sum(N))

Solution (Python):
abc = sorted(map(int, input().split()))
abc[2] *= 2 ** int(input())
print(sum(abc))

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

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

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

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

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

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

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

Solution (Python):

A = [int(j) for j in input().split()]
K=int(input())
A.sort()
print(A[2]*((2**K)-1)+sum(A))

Solution (Python):

A = [int(j) for j in input().split()]
K=int(input())
for i in range(K):
    A.sort()
    A[2]=A[2]*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*(-1+2**K))

Solution (Python):
m=list(map(int,input().split()))
k=int(input())
m.append(max(m)*2**k)
m.remove(sorted(m)[-2])
print(sum(m))

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

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

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

Solution (Python):

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

Solution (Python):
from collections import Counter
from functools import reduce
import fractions
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  
def LF(): return [float(x) for x in sys.stdin.readline().split()]  
def LS(): return sys.stdin.readline().split()  
def MI(): return map(int, sys.stdin.readline().split())  
def II(): return int(sys.stdin.readline())  
def IS(): return input()  
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


li = LI()
k = II()
print(li[0] + li[1] + li[2] + max(li)*((2**k)-1))

Solution (Python):
from collections import Counter
from functools import reduce
import fractions
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  
def LF(): return [float(x) for x in sys.stdin.readline().split()]  
def LS(): return sys.stdin.readline().split()  
def MI(): return map(int, sys.stdin.readline().split())  
def II(): return int(sys.stdin.readline())  
def IS(): return input()  
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


li = LI()
k = II()
ans = []

def calc(a, b, c, count):

    if count == k:
        val = a+b+c
        ans.append(val)
        count -= 1
        return

    count += 1
    calc(a*2, b, c, count)
    calc(a, b*2, c, count)
    calc(a, b, c*2, count)


calc(li[0], li[1], li[2], 0)
print(max(ans))

Solution (Python):
A,B,C = map(int,input().split())
lists = [A,B,C]
K = int(input())
X = 0
for i in range(K):
    X = max(lists) * 2
    for j in range(len(lists)):
        if lists[j] == max(lists):
            lists[j] = X
print(sum(lists))

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

K = int(input())

for i in range(K):
  A = sorted(A)
  amax = A.pop(-1) * 2
  A.append(amax)

print(sum(A))

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

m = max([A, B, C])
ans = A + B + C - m
for i in range(K):
    m *= 2
ans += m

print(ans)

Solution (Python):
a, b, c, K = map(int, open(0).read().split())
m = max(a, b, c)
print(m*2**K+a+b+c-m)

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

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

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

Solution (Python):
A, B, C = map(int, input().split())
K = int(input())
arr = [A, B, C]
for _ in range(K):
    arr1 = 2 * arr[0] + arr[1] + arr[2]
    arr2 = arr[0] + 2 * arr[1] + arr[2]
    arr3 = arr[0] + arr[1] + 2 * arr[2]
    tmp = [arr1, arr2, arr3]
    idx = tmp.index(max(tmp))
    arr[idx] *= 2
print(sum(arr))

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

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

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


def my_pow(b,p):
    tmp = 1
    for i in range(0,p):
        tmp *= b
    return tmp


abc = sorted(abc)

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

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

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

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

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

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

print(ans)

Solution (Python):
A=[int(x) for x in input().split()]
K=int(input())
A.sort()
A[-1]*=2**K
print(sum(A))

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

Solution (Python):
from sys import stdin
A,B,C=[int(x) for x in stdin.readline().rstrip().split()]
K=int(stdin.readline().rstrip())
data=[A,B,C]
data=sorted(data)
data[-1]=data[-1]*(2**K)
print(sum(data))

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

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

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