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.



Sample input:
5 3 11
1


Sample output:
30

Submission status: Accepted

Solution code:
###############################################################################

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:



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

Submission status: Accepted

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

Submission status: Accepted

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

ABC.sort(reverse=True)

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    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()

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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)

Submission status: Accepted

Solution code:
A = [int(x) for x in input().split()]
K = int(input())

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

Submission status: Accepted

Solution code:
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)]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(X))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
# ABC096B - Maximum Sum
# In progress
a, b, c = sorted(list(map(int, input().rstrip().split())), reverse=True)
k = int(input())
print(a * 2 ** k + b + c)

Submission status: Accepted

Solution code:
# ABC096B - Maximum Sum
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = sorted(list(map(int, input().split())))[:: -1]
K = int(input())
for _ in range(K):
	A[0] = 2 * max(A)
print(sum(A))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(A, B, C, K)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# coding= utf_8
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))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#094 B
A = [int(j) for j in input().split()]
K=int(input())
A.sort()
print(A[2]*((2**K)-1)+sum(A))

Submission status: Accepted

Solution code:
#094 B
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))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding: utf-8
l = list(map(int, input().split()))
K = int(input())
l.sort()
print(sum(l[:2]) + l[-1] * 2 ** K)

Submission status: Accepted

Solution code:
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()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # greatest common divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # least common multiple
    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))

Submission status: Accepted

Solution code:
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()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # greatest common divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # least common multiple
    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))
# 変だな

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
abc = input().split()

a = int(abc[0])
b = int(abc[1])
c = int(abc[2])
k = int(input())

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

print(ab + d)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
k = int(input())
num = [a,b,c]
for i in range(k):
    n = max(num)
    index_n = num.index(n)
    num[index_n] = num[index_n]*2
print(sum(num))

Submission status: Accepted

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

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

print(ans + A + B + C)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

Submission status: Accepted

Solution code:
num_list = sorted(list(map(int, input().split())))
k = int(input())
num_max = num_list.pop()
num_max = (2**k)*num_max
print(sum(num_list)+num_max)

Submission status: Accepted

Solution code:
ABC = [int(i) for i in input().split()]
ABC.sort()
K = int(input())
ABC[-1] = ABC[-1]*2**K
print(sum(ABC))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for _ in range(K):
    C *= 2
print(A+B+C)

Submission status: Accepted

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

total = 0

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

print(a+b+c)

Submission status: Accepted

Solution code:
a, b, c = sorted([int(i) for i in input().split()])
k = int(input())
for i in range(k):
    c = c * 2
ans = a+b+c
print(ans)

Submission status: Accepted

Solution code:
a = [int(item) for item in input().split()]
k = int(input())
a.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
l = [int(x) for x in stdin.readline().rstrip().split()]
l.sort()
k = int(stdin.readline().rstrip())
print(l[2]*(2**k) + l[0] + l[1])

Submission status: Accepted

Solution code:
A, B, C = [int(x) for x in input().split()]
K = int(input())

for _ in range(K):
    if max(A, B, C) == A:
        A *= 2
    elif max(A, B, C) == B:
        B *= 2
    else:
        C *= 2
ans = A + B + C

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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