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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum(number))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum(abc))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(l))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

a=sorted(a,reverse=True)

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

Submission status: Accepted

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


if __name__ == '__main__':
    slove()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

    print(sum(abc))

bb096()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(R+M)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

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:
ABC = list(map(int, input().split()))
ABC.sort(reverse=True)

K = int(input())

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

print(sum(ABC))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# ABC096B - Maximum Sum
def main():
    A, B, C = sorted(map(int, input().split()), reverse=1)
    K = int(input())
    ans = A * 2 ** K + B + C
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(sum(abc))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from functools import reduce
import copy
import math


sys.setrecursionlimit(4100000)


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


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


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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC096b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC096 B - Maximum Sum
l = list(map(int,input().split()))
k = int(input())

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

print(sum(l))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

A = sorted(A)

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

Submission status: Accepted

Solution code:


def main():


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






if __name__== "__main__":
    main()

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*(2**k-1)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

lst = sorted(ILI())
K = II()
ans = lst[-1]*2**K + sum(lst[:-1])
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

M       = max(A, B, C)

print(A+B+M*(2**K) if M==C else A+M*(2**K)+C if M==B else M*(2**K)+B+C)

Submission status: Accepted

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

max_abc = ABC_LIST[-1]

ans = ((2**K) * max_abc) + sum(ABC_LIST[:2])

print(ans)

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 + m * 2 ** k)

Submission status: Accepted

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

tmp = a+b+c - max([a, b, c])
print(tmp + max([a, b, c]) * pow(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:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


l = list(map(int, sys.stdin.readline().split()))
K =  int(sys.stdin.readline())

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

Submission status: Accepted

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

print(a + b + c * (1 << k))

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

li = na()
k = ni()
print(sum(li) - max(li) + max(li) * (2 ** k))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l,k=open(0);l=list(map(int,l.split()));print(sum(l)+max(l)*(2**int(k)-1))

Submission status: Accepted

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


if __name__ == "__main__":
    test()

Submission status: Accepted

Solution code:
a,b,c=[int(j) for j in input().split()]
k=int(input())
print(a+b+c-max(a,b,c)+max(a,b,c)*2**k)

Submission status: Accepted

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


max_num = max(abc)
abc.remove(max_num)
print(sum(abc) + max_num * 2 ** (k))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
k = int(input())
ans = 0
for i in range(k+1):
    for j in range(k+1-i):
        n = k - (i + j)
        res = a * 2 ** i + b * 2 ** j + c * 2 ** n
        ans = max(ans,res)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = sorted(list(map(int, input().split())), reverse=True)
k = int(input())

for i in range(k):
    t = n.pop(0)
    n.append(t*2)
    n = sorted(n, reverse=True)
    
print(sum(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq
def main():
    A, B, C = map(int, input().split())
    K = int(input())
    lv = []
    heapq.heappush(lv, -A)
    heapq.heappush(lv, -B)
    heapq.heappush(lv, -C)

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

    return -sum(lv)
    
if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A=sorted([int(i)for i in input().split()])
k=int(input())
print(A[0]+A[1]+A[2]*2**k)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum(ABC))

Submission status: Accepted

Solution code:
abc=list(map(int,input().split()))
k=int(input())
ma=max(abc)
for i in range(k):
    ma*=2
abc=sorted(abc)
print(abc[0]+abc[1]+ma)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    abc = list(map(int, input().split()))
    K = int(input())
    for _ in range(K):
        abc_sorted = sorted(abc, reverse=True)
        for num in abc_sorted:
            #if num*2 <= 50:
                abc[abc.index(num)] = num*2
                break
    print(sum(abc))

Submission status: Accepted

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

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

Submission status: Accepted

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

max_num=max(abc)

print(sum(abc)-max(abc)+max_num*(2**k))

Submission status: Accepted

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

max_num=max(abc)
for _ in range(k):
    max_num*=2

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

Submission status: Accepted

Solution code:
n=list(map(int,input().split()))
k=int(input())
top=n.index(max(n))
n[top]=n[top]*2**k
print(sum(n))

Submission status: Accepted

Solution code:
a,b,c,k=map(int,open(0).read().split())

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

Submission status: Accepted

Solution code:
A, B, C = [int(x) for x in input().split()]
print(max(A, B, C) * (2 ** int(input())) + sum([A, B, C]) - max(A, B, C))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

ans = 0
for i in range(k):
    ptn = [
        A[0]*2+A[1]+A[2],
        A[0]+A[1]*2+A[2],
        A[0]+A[1]+A[2]*2,
    ]
    idx = ptn.index(max(ptn))
    A[idx] *= 2

    ans = max(ptn)

print(ans)

Submission status: Accepted

Solution code:

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

ans = 0
for i in range(k):
    ptn = [
        A[0]*2+A[1]+A[2],
        A[0]+A[1]*2+A[2],
        A[0]+A[1]+A[2]*2,
    ]
    idx = ptn.index(max(ptn))
    if idx == 0:
        A = [A[0]*2, A[1], A[2]]
    elif idx == 1:
        A = [A[0], A[1]*2, A[2]]
    else:
        A = [A[0], A[1], A[2]*2]

    ans = max(ptn)

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
li = list(map(int, input().split()))
m = 0
for i, j in enumerate(sorted(li)[::-1]):
    if i == 0:
        m += j * 2 ** int(input())
    else:
        m += j
print(m)

Submission status: Accepted

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

abc.sort()
mx=abc.pop()*2**k
print(sum(abc)+mx)

Submission status: Accepted

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

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

    A[A.index(max(A))] = max(A) * 2 ** K

    print(sum(A))

    


main()

Submission status: Accepted

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

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:
x = list(map(int, input().split()))
k = int(input())
x.sort()
print(x[0] + x[1] + x[2]*2**k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
val = input()
val = [int(x.strip()) for x in val.split(" ")]
k = int(input())
A = val[0]
B = val[1]
C = val[2]
ans = sum(val)
D = ((A if A > B else B) if (A if A > B else B) > C else C)
ans -= D
ans += D * 2 ** k
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(D))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(num)-max(num)+max(num)*2**int(input()))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(sum(nums))

Submission status: Accepted

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

A.sort()
for k 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 + m*2**k)

Submission status: Accepted

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

saidai = max(A,B,C)

if saidai == A:
    print(A * 2 ** K + B + C)
elif saidai == B:
    print(B * 2 ** K + A + C)
elif saidai == C:
    print(C * 2 ** K + A + B)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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