import java.util.*;
import java.lang.Math;

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();
        int max = 0;

        for (int i = 0; i <= k; i++) {
            for (int j = 0; j <= k - i; j++) {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            }
        }
        System.out.println(max);
    }
} import java.util.*; util.* java import java.lang.Math; Math java.lang 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();
        int max = 0;

        for (int i = 0; i <= k; i++) {
            for (int j = 0; j <= k - i; j++) {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            }
        }
        System.out.println(max);
    }
} 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();
        int max = 0;

        for (int i = 0; i <= k; i++) {
            for (int j = 0; j <= k - i; j++) {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            }
        }
        System.out.println(max);
    } main {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        int max = 0;

        for (int i = 0; i <= k; i++) {
            for (int j = 0; j <= k - i; j++) {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            }
        }
        System.out.println(max);
    } 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 int max = 0; max 0 for (int i = 0; i <= k; i++) {
            for (int j = 0; j <= k - i; j++) {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            }
        } int i = 0; int i = 0; i 0 i <= k i k i++ i++ i {
            for (int j = 0; j <= k - i; j++) {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            }
        } {
            for (int j = 0; j <= k - i; j++) {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            }
        } for (int j = 0; j <= k - i; j++) {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            } int j = 0; int j = 0; j 0 j <= k - i j k - i k i j++ j++ j {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            } {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            } int h = k - i - j; h k - i - j k - i - j k i j int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h); sum a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h) a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h) a * (int)Math.pow(2, i) a (int)Math.pow(2, i) Math.pow Math 2 i b * (int)Math.pow(2, j) b (int)Math.pow(2, j) Math.pow Math 2 j c * (int)Math.pow(2, h) c (int)Math.pow(2, h) Math.pow Math 2 h if (sum > max) {
                    max = sum;
                } sum > max sum max {
                    max = sum;
                } max = sum max sum System.out.println(max) System.out.println System.out System System.out max String args[] args 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();
        int max = 0;

        for (int i = 0; i <= k; i++) {
            for (int j = 0; j <= k - i; j++) {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            }
        }
        System.out.println(max);
    }
} 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();
        int max = 0;

        for (int i = 0; i <= k; i++) {
            for (int j = 0; j <= k - i; j++) {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            }
        }
        System.out.println(max);
    }
} Main
import java.util.*;
import java.lang.Math;

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();
        int max = 0;

        for (int i = 0; i <= k; i++) {
            for (int j = 0; j <= k - i; j++) {
                int h = k - i - j;
                int sum = a * (int)Math.pow(2, i) + b * (int)Math.pow(2, j) + c * (int)Math.pow(2, h);
                if (sum > max) {
                    max = sum;
                }
            }
        }
        System.out.println(max);
    }
}