import java.util.Scanner;

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int K = sc.nextInt();

        System.out.println(solve(A, B, C, K));

        sc.close();
    }

    static int solve(int A, int B, int C, int K) {
        return A + B + C + Math.max(Math.max(A, B), C) * ((1 << K) - 1);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int K = sc.nextInt();

        System.out.println(solve(A, B, C, K));

        sc.close();
    }

    static int solve(int A, int B, int C, int K) {
        return A + B + C + Math.max(Math.max(A, B), C) * ((1 << K) - 1);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int K = sc.nextInt();

        System.out.println(solve(A, B, C, K));

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int K = sc.nextInt();

        System.out.println(solve(A, B, C, K));

        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc int C = sc.nextInt(); C sc.nextInt() sc.nextInt sc int K = sc.nextInt(); K sc.nextInt() sc.nextInt sc System.out.println(solve(A, B, C, K)) System.out.println System.out System System.out solve(A, B, C, K) solve A B C K sc.close() sc.close sc String[] args args static int solve(int A, int B, int C, int K) {
        return A + B + C + Math.max(Math.max(A, B), C) * ((1 << K) - 1);
    } solve {
        return A + B + C + Math.max(Math.max(A, B), C) * ((1 << K) - 1);
    } return A + B + C + Math.max(Math.max(A, B), C) * ((1 << K) - 1); A + B + C + Math.max(Math.max(A, B), C) * ((1 << K) - 1) C A + B + C + Math.max(Math.max(A, B), C) * ((1 << K) - 1) A B C Math.max(Math.max(A, B), C) * ((1 << K) - 1) Math.max(Math.max(A, B), C) Math.max Math Math.max(A, B) Math.max Math A B C ((1 << K) - 1) (1 << K) 1 K 1 int A A int B B int C C int K K public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int K = sc.nextInt();

        System.out.println(solve(A, B, C, K));

        sc.close();
    }

    static int solve(int A, int B, int C, int K) {
        return A + B + C + Math.max(Math.max(A, B), C) * ((1 << K) - 1);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int K = sc.nextInt();

        System.out.println(solve(A, B, C, K));

        sc.close();
    }

    static int solve(int A, int B, int C, int K) {
        return A + B + C + Math.max(Math.max(A, B), C) * ((1 << K) - 1);
    }
} Main
import java.util.Scanner;

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int K = sc.nextInt();

        System.out.println(solve(A, B, C, K));

        sc.close();
    }

    static int solve(int A, int B, int C, int K) {
        return A + B + C + Math.max(Math.max(A, B), C) * ((1 << K) - 1);
    }
}