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

mt = max(lis)

a = sum(lis)-mt

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
#n=int(input())
a,b,c=map(int,input().split())
k=int(input())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

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

print(total+mx)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(sum(numbers))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
ABC=list(map(int,input().split()))
K=int(input())
ABC.sort()
ABC[2]*=2**K
print(sum(ABC))

Submission status: Accepted

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

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

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=map(int,open(0).read().split());print(sum(a)+max(a)*(2**b-1))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

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

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

Submission status: Accepted

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

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

print(sum(abc))

Submission status: Accepted

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

a=nl()
k=ni()

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

print(sum(a))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
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

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

# import fractions

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

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

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

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


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    a, b, c = mi()
    k = ii()
    print(a + b + c + (pow(2, k) - 1) * max(a, b, c))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
arr = []

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import heapq

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

m=max(a,b,c)
for _ in range(k):
    m*=2

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum(l))

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

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

#############
# Functions #
#############

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

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

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

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

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

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

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

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

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

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

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

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


#############
# Main Code #
#############

A = inputIL()
K = inputI()

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

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math,numpy, collections

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

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

Submission status: Accepted

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

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

kazu=[a,b,c]
kazu.sort()
#print(kazu)
print(kazu[0]+kazu[1]+kazu[2]*2**k)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

ans=0
for i1 in range(k+1):
    for i2 in range(k+1):
        for i3 in range(k+1):
#            print(i1,i2,i3)
            if (i1+i2+i3==k):
                temp=a*2**(i1)+b*2**(i2)+c*2**(i3)
#                print(temp)
                ans=max(ans,temp)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 17:23:47 2020

@author: shinba
"""

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

A.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(A))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c,=map(int,input().split())
k=int(input())
while k>0:
    if max(a,b,c)==c:
        c=2*c
        k-=1
    elif max(a,b,c)==b:
        b=2*b
        k-=1
    else:
        a=2*a
        k-=1
print(sum([a,b,c]))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(max_sum)

Submission status: Accepted

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

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

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

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

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
print(sum(a))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math

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

Submission status: Accepted

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

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

print(sum(N))

Submission status: Accepted

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

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

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