import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] numbers = new int[3];
        numbers[0] = in.nextInt();
        numbers[1] = in.nextInt();
        numbers[2] = in.nextInt();
        Arrays.sort(numbers);
        System.out.println((int) Math.pow(2, in.nextInt()) * numbers[2] + numbers[0] + numbers[1]);
        in.close();
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] numbers = new int[3];
        numbers[0] = in.nextInt();
        numbers[1] = in.nextInt();
        numbers[2] = in.nextInt();
        Arrays.sort(numbers);
        System.out.println((int) Math.pow(2, in.nextInt()) * numbers[2] + numbers[0] + numbers[1]);
        in.close();
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] numbers = new int[3];
        numbers[0] = in.nextInt();
        numbers[1] = in.nextInt();
        numbers[2] = in.nextInt();
        Arrays.sort(numbers);
        System.out.println((int) Math.pow(2, in.nextInt()) * numbers[2] + numbers[0] + numbers[1]);
        in.close();
    } main {
        Scanner in = new Scanner(System.in);
        int[] numbers = new int[3];
        numbers[0] = in.nextInt();
        numbers[1] = in.nextInt();
        numbers[2] = in.nextInt();
        Arrays.sort(numbers);
        System.out.println((int) Math.pow(2, in.nextInt()) * numbers[2] + numbers[0] + numbers[1]);
        in.close();
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int[] numbers = new int[3]; numbers new int[3] 3 numbers[0] = in.nextInt() numbers[0] numbers 0 in.nextInt() in.nextInt in numbers[1] = in.nextInt() numbers[1] numbers 1 in.nextInt() in.nextInt in numbers[2] = in.nextInt() numbers[2] numbers 2 in.nextInt() in.nextInt in Arrays.sort(numbers) Arrays.sort Arrays numbers System.out.println((int) Math.pow(2, in.nextInt()) * numbers[2] + numbers[0] + numbers[1]) System.out.println System.out System System.out (int) Math.pow(2, in.nextInt()) * numbers[2] + numbers[0] + numbers[1] (int) Math.pow(2, in.nextInt()) * numbers[2] + numbers[0] + numbers[1] (int) Math.pow(2, in.nextInt()) * numbers[2] (int) Math.pow(2, in.nextInt()) Math.pow Math 2 in.nextInt() in.nextInt in numbers[2] numbers 2 numbers[0] numbers 0 numbers[1] numbers 1 in.close() in.close in String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] numbers = new int[3];
        numbers[0] = in.nextInt();
        numbers[1] = in.nextInt();
        numbers[2] = in.nextInt();
        Arrays.sort(numbers);
        System.out.println((int) Math.pow(2, in.nextInt()) * numbers[2] + numbers[0] + numbers[1]);
        in.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] numbers = new int[3];
        numbers[0] = in.nextInt();
        numbers[1] = in.nextInt();
        numbers[2] = in.nextInt();
        Arrays.sort(numbers);
        System.out.println((int) Math.pow(2, in.nextInt()) * numbers[2] + numbers[0] + numbers[1]);
        in.close();
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] numbers = new int[3];
        numbers[0] = in.nextInt();
        numbers[1] = in.nextInt();
        numbers[2] = in.nextInt();
        Arrays.sort(numbers);
        System.out.println((int) Math.pow(2, in.nextInt()) * numbers[2] + numbers[0] + numbers[1]);
        in.close();
    }
}