import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int[] num = new int[3];
        int largest = 0;
        int index = 0;
        int sum = 0;

        for (int i = 0; i < 3; i++) {
            num[i] = sc.nextInt();
            if (num[i] > largest) {
                largest = num[i];
                index = i;
            }
        }
        int k = sc.nextInt();
        for (int i = 0; i < 3; i++) {
            if (i == index) {
                sum += num[i]* Math.pow(2, k);
            } else {
                sum += num[i];
            }
        }
        System.out.println(sum);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int[] num = new int[3];
        int largest = 0;
        int index = 0;
        int sum = 0;

        for (int i = 0; i < 3; i++) {
            num[i] = sc.nextInt();
            if (num[i] > largest) {
                largest = num[i];
                index = i;
            }
        }
        int k = sc.nextInt();
        for (int i = 0; i < 3; i++) {
            if (i == index) {
                sum += num[i]* Math.pow(2, k);
            } else {
                sum += num[i];
            }
        }
        System.out.println(sum);
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int[] num = new int[3];
        int largest = 0;
        int index = 0;
        int sum = 0;

        for (int i = 0; i < 3; i++) {
            num[i] = sc.nextInt();
            if (num[i] > largest) {
                largest = num[i];
                index = i;
            }
        }
        int k = sc.nextInt();
        for (int i = 0; i < 3; i++) {
            if (i == index) {
                sum += num[i]* Math.pow(2, k);
            } else {
                sum += num[i];
            }
        }
        System.out.println(sum);
    } main {

        Scanner sc = new Scanner(System.in);
        int[] num = new int[3];
        int largest = 0;
        int index = 0;
        int sum = 0;

        for (int i = 0; i < 3; i++) {
            num[i] = sc.nextInt();
            if (num[i] > largest) {
                largest = num[i];
                index = i;
            }
        }
        int k = sc.nextInt();
        for (int i = 0; i < 3; i++) {
            if (i == index) {
                sum += num[i]* Math.pow(2, k);
            } else {
                sum += num[i];
            }
        }
        System.out.println(sum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] num = new int[3]; num new int[3] 3 int largest = 0; largest 0 int index = 0; index 0 int sum = 0; sum 0 for (int i = 0; i < 3; i++) {
            num[i] = sc.nextInt();
            if (num[i] > largest) {
                largest = num[i];
                index = i;
            }
        } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
            num[i] = sc.nextInt();
            if (num[i] > largest) {
                largest = num[i];
                index = i;
            }
        } {
            num[i] = sc.nextInt();
            if (num[i] > largest) {
                largest = num[i];
                index = i;
            }
        } num[i] = sc.nextInt() num[i] num i sc.nextInt() sc.nextInt sc if (num[i] > largest) {
                largest = num[i];
                index = i;
            } num[i] > largest num[i] num i largest {
                largest = num[i];
                index = i;
            } largest = num[i] largest num[i] num i index = i index i int k = sc.nextInt(); k sc.nextInt() sc.nextInt sc for (int i = 0; i < 3; i++) {
            if (i == index) {
                sum += num[i]* Math.pow(2, k);
            } else {
                sum += num[i];
            }
        } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
            if (i == index) {
                sum += num[i]* Math.pow(2, k);
            } else {
                sum += num[i];
            }
        } {
            if (i == index) {
                sum += num[i]* Math.pow(2, k);
            } else {
                sum += num[i];
            }
        } if (i == index) {
                sum += num[i]* Math.pow(2, k);
            } else {
                sum += num[i];
            } i == index i index {
                sum += num[i]* Math.pow(2, k);
            } sum += num[i]* Math.pow(2, k) sum num[i]* Math.pow(2, k) num[i] num i Math.pow(2, k) Math.pow Math 2 k {
                sum += num[i];
            } sum += num[i] sum num[i] num i System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int[] num = new int[3];
        int largest = 0;
        int index = 0;
        int sum = 0;

        for (int i = 0; i < 3; i++) {
            num[i] = sc.nextInt();
            if (num[i] > largest) {
                largest = num[i];
                index = i;
            }
        }
        int k = sc.nextInt();
        for (int i = 0; i < 3; i++) {
            if (i == index) {
                sum += num[i]* Math.pow(2, k);
            } else {
                sum += num[i];
            }
        }
        System.out.println(sum);
    }
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int[] num = new int[3];
        int largest = 0;
        int index = 0;
        int sum = 0;

        for (int i = 0; i < 3; i++) {
            num[i] = sc.nextInt();
            if (num[i] > largest) {
                largest = num[i];
                index = i;
            }
        }
        int k = sc.nextInt();
        for (int i = 0; i < 3; i++) {
            if (i == index) {
                sum += num[i]* Math.pow(2, k);
            } else {
                sum += num[i];
            }
        }
        System.out.println(sum);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int[] num = new int[3];
        int largest = 0;
        int index = 0;
        int sum = 0;

        for (int i = 0; i < 3; i++) {
            num[i] = sc.nextInt();
            if (num[i] > largest) {
                largest = num[i];
                index = i;
            }
        }
        int k = sc.nextInt();
        for (int i = 0; i < 3; i++) {
            if (i == index) {
                sum += num[i]* Math.pow(2, k);
            } else {
                sum += num[i];
            }
        }
        System.out.println(sum);
    }
}