import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int total = 0;
        int max = -1;
        for (int i = 0; i < 3; i++) {
            int a = sc.nextInt();
            max = Math.max(a, max);
            total += a;
        }
        int k = sc.nextInt();
        total += (int)Math.pow(2, k) * max;
        total -= max;

        System.out.println(total);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int total = 0;
        int max = -1;
        for (int i = 0; i < 3; i++) {
            int a = sc.nextInt();
            max = Math.max(a, max);
            total += a;
        }
        int k = sc.nextInt();
        total += (int)Math.pow(2, k) * max;
        total -= max;

        System.out.println(total);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int total = 0;
        int max = -1;
        for (int i = 0; i < 3; i++) {
            int a = sc.nextInt();
            max = Math.max(a, max);
            total += a;
        }
        int k = sc.nextInt();
        total += (int)Math.pow(2, k) * max;
        total -= max;

        System.out.println(total);
    } main {
        Scanner sc = new Scanner(System.in);

        int total = 0;
        int max = -1;
        for (int i = 0; i < 3; i++) {
            int a = sc.nextInt();
            max = Math.max(a, max);
            total += a;
        }
        int k = sc.nextInt();
        total += (int)Math.pow(2, k) * max;
        total -= max;

        System.out.println(total);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int total = 0; total 0 int max = -1; max -1 1 for (int i = 0; i < 3; i++) {
            int a = sc.nextInt();
            max = Math.max(a, max);
            total += a;
        } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
            int a = sc.nextInt();
            max = Math.max(a, max);
            total += a;
        } {
            int a = sc.nextInt();
            max = Math.max(a, max);
            total += a;
        } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc max = Math.max(a, max) max Math.max(a, max) Math.max Math a max total += a total a int k = sc.nextInt(); k sc.nextInt() sc.nextInt sc total += (int)Math.pow(2, k) * max total (int)Math.pow(2, k) * max (int)Math.pow(2, k) Math.pow Math 2 k max total -= max total max System.out.println(total) System.out.println System.out System System.out total String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int total = 0;
        int max = -1;
        for (int i = 0; i < 3; i++) {
            int a = sc.nextInt();
            max = Math.max(a, max);
            total += a;
        }
        int k = sc.nextInt();
        total += (int)Math.pow(2, k) * max;
        total -= max;

        System.out.println(total);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int total = 0;
        int max = -1;
        for (int i = 0; i < 3; i++) {
            int a = sc.nextInt();
            max = Math.max(a, max);
            total += a;
        }
        int k = sc.nextInt();
        total += (int)Math.pow(2, k) * max;
        total -= max;

        System.out.println(total);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int total = 0;
        int max = -1;
        for (int i = 0; i < 3; i++) {
            int a = sc.nextInt();
            max = Math.max(a, max);
            total += a;
        }
        int k = sc.nextInt();
        total += (int)Math.pow(2, k) * max;
        total -= max;

        System.out.println(total);
    }
}
