#abc096b. [abc096_b]Maximum Sum

[abc096_b]Maximum Sum

Problem Statement

There are three positive integers AA, BB and CC written on a blackboard. E869120 performs the following operation KK times:

  • Choose one integer written on the blackboard and let the chosen integer be nn. Replace the chosen integer with 2n2n.

What is the largest possible sum of the integers written on the blackboard after KK operations?

Constraints

  • A,BA, B and CC are integers between 11 and 5050 (inclusive).
  • KK is an integer between 11 and 1010 (inclusive).

Input

Input is given from Standard Input in the following format:

AA BB CC KK

Output

Print the largest possible sum of the integers written on the blackboard after KK operations by E869220.


Sample Input 1

5 3 11
1

Sample Output 1

30

In this sample, 5,3,115, 3, 11 are initially written on the blackboard, and E869120 can perform the operation once.
There are three choices:

  1. Double 55: The integers written on the board after the operation are 10,3,1110, 3, 11.
  2. Double 33: The integers written on the board after the operation are 5,6,115, 6, 11.
  3. Double 1111: The integers written on the board after the operation are 5,3,225, 3, 22.

If he chooses 3., the sum of the integers written on the board afterwards is 5+3+22=305 + 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 44. The integers written on the board are now 3,3,83, 3, 8.
  • Next, double 88. The integers written on the board are now 3,3,163, 3, 16.

Then, the sum of the integers eventually written on the blackboard is 3+3+16=223 + 3 + 16 = 22.