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-----
5 3 11
1

-----Sample Output-----
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.

Difficulty: EASY

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


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


(a, b, c) = map(int, input().split())
n = int(input())
(a, b, c) = sorted([a, b, c])
print(a + b + c * 2 ** n)


(a, b, c) = sorted(map(int, input().split()))
print(a + b + pow(2, int(input())) * c)


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


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


(A, B, C) = sorted(map(int, input().split()))
print(A + B + C * pow(2, int(input())))


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


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


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


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


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


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


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


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


(A, B, C) = sorted([int(i) for i in input().split()])
K = int(input())
print(A + B + C * 2 ** K)


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


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


(A, B, C) = map(int, input().split())
K = int(input())
n_list = [A, B, C]
x = max(n_list)
n_list.append(x * 2 ** K)
n_list.remove(x)
print(sum(n_list))


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


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


A = sorted(list(map(int, input().split())))
A[2] *= 2 ** int(input())
print(sum(A))


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


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


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


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


x = sorted(map(int, input().split()))
k = int(input())
print(x[0] + x[1] + x[2] * 2 ** k)


lst = input().split()
K = int(input())
for i in range(3):
	lst[i] = int(lst[i])
print(sum(lst) + max(lst) * (2 ** K - 1))


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


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


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


l = [int(_) for _ in input().split()]
k = int(input())
print(max(l) * 2 ** k + sum(l) - max(l))


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


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


a = [int(i) for i in input().split()]
k = int(input())
sum_a = sum(a)
ans = sum_a - max(a) + max(a) * 2 ** k
print(ans)


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


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


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


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


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


import sys
lines = [s.rstrip('\n') for s in sys.stdin.readlines()]
num_list = [int(num) for num in lines.pop(0).split(' ')]
(k,) = [int(num) for num in lines.pop(0).split(' ')]
m = max(num_list)
ans = sum(num_list) - m + m * 2 ** k
print(ans)


l = list(map(int, input().split()))
n = int(input())
ls = sorted(l)
print(ls[0] + ls[1] + ls[2] * 2 ** n)


p = input
(*x,) = map(int, p().split())
print(sum(x) + max(x) * (2 ** int(p()) - 1))


A = list(map(int, input().split()))
K = int(input())
A.sort()
A[2] = A[2] * 2 ** K
print(sum(A))


N_List = list(map(int, input().split()))
N = int(input())
maxN = max(N_List)
print(sum(N_List) - maxN + maxN * 2 ** N)


p = input
a = [int(i) for i in p().split()]
m = max(a)
print(sum(a) - m + m * 2 ** int(p()))


(a, b, c) = sorted(map(int, input().split()))
K = int(input())
print(2 ** K * c + a + b)


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


import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

def I():
	return int(input())

def F():
	return float(input())

def SS():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

def LSS():
	return input().split()

def resolve():
	ABC = LI()
	K = I()
	ABC.sort()
	ans = sum(ABC[:2]) + ABC[2] * 2 ** K
	print(ans)

def __starting_point():
	resolve()
__starting_point()


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


def main():
	A = list(map(int, input().split()))
	K = int(input())
	A.sort()
	A.append(A.pop() * 2 ** K)
	print(sum(A))

def __starting_point():
	main()
__starting_point()


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


N = list(map(int, input().split()))
K = int(input())
print(sum(N) + max(N) * (2 ** K - 1))


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


a = list(map(int, input().split()))
a.sort()
a[2] = a[2] * 2 ** int(input())
print(sum(a))


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


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


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


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


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


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


(m, *A) = sorted([int(x) for x in input().split()], reverse=True)
K = int(input())
print(m * 2 ** K + sum(A))


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


s = sorted(list(map(int, input().split())))
print(s[0] + s[1] + s[2] * 2 ** int(input()))


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


a = [int(i) for i in input().split()]
k = int(input())
a.sort()
print(a[2] * 2 ** k + a[0] + a[1])


ABC = sorted(map(int, input().split()))
K = int(input())
print(ABC[0] + ABC[1] + ABC[2] * 2 ** K)


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


l = list(map(int, input().split()))
k = int(input())
d = max(l)
e = d * 2 ** k
l.remove(max(l))
l.append(e)
print(sum(l))


x = [int(i) for i in input().split()]
x.sort()
n = int(input())
print(x[2] * 2 ** n + x[0] + x[1])


L = sorted(map(int, input().split()))
k = int(input())
print(L[0] + L[1] + L[2] * 2 ** k)


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


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


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


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


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


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


nums = sorted(list(map(int, input().split())), reverse=True)
K = int(input())
print(nums[0] * 2 ** K + nums[1] + nums[2])


L = list(map(int, input().split()))
K = int(input())
N = sorted(L)
print(N[0] + N[1] + N[2] * 2 ** K)


l = list(map(int, input().split()))
k = int(input())
i = l.index(max(l))
m = l[i]
del l[i]
l.append(m * 2 ** k)
print(sum(l))


(A, B, C) = [int(i) for i in input().split()]
K = int(input())
m = max(A, B, C)
print(sum([A, B, C]) - m + m * 2 ** K)


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


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


X = list(map(int, input().split()))
K = int(input())
print(sum(X) + max(X) * (2 ** K - 1))


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


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


abc = list(map(int, input().split()))
k = int(input())
mx = abc.pop(abc.index(max(abc)))
print(mx * pow(2, k) + sum(abc))


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


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


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


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


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


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


list_abc = sorted([int(i) for i in input().split()])
k = int(input())
print(list_abc[2] * 2 ** k + sum(list_abc[:2]))


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


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


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


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


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


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


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


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


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


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


(a, b, c) = map(int, input().split())
d = int(input())
e = max(a, b, c)
f = a + b + c + e * 2 ** d - e
print(f)


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


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


a = sorted(map(int, input().split()))
k = int(input())
a[2] = a[2] * 2 ** k
print(sum(a))


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


(A, B, C) = map(int, input().split())
X = max(A, B, C)
print(X * 2 ** int(input()) + (A + B + C - X))


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


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


(A, B, C) = map(int, input().split())
Max = max(A, B, C)
K = int(input())
Max *= 2 ** K
print(min(A + B + Max, A + Max + C, Max + B + C))


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


a = [int(i) for i in input().split()]
b = int(input())
print(sum(a) - max(a) + max(a) * 2 ** b)


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


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


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


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


(*a, b) = list(map(int, open(0).read().split()))
print(sum(sorted(a)[:2]) + max(a) * 2 ** b)


def answer(a: int, b: int, c: int, k: int) -> int:
	nums = sorted((a, b, c))
	nums[-1] = nums[-1] * 2 ** k
	return sum(nums)

def main():
	(a, b, c) = list(map(int, input().split()))
	k = int(input())
	print(answer(a, b, c, k))

def __starting_point():
	main()
__starting_point()


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


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


(A, B, C) = map(int, input().split())
K = int(input())
M = sorted([A, B, C])
m = M[-1]
m = m * 2 ** K
print(m + M[0] + M[1])


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


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


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


(A, B, C) = map(int, input().split())
k = int(input())
m = max(A, B, C)
print(A + B + C - m + m * 2 ** k)


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


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