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();
        double k = (double)sc.nextInt();


        if (Math.max(Math.max(a,b), c) == c){
            System.out.println(a+b+c*(int)Math.pow(2, k));
        }else if (Math.max(Math.max(a, b), c) == b){
            System.out.println(a+b*(int)Math.pow(2, k)+c);
        }else{
            System.out.println(b+c+a*(int)Math.pow(2, k));
        }
    }
} 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();
        double k = (double)sc.nextInt();


        if (Math.max(Math.max(a,b), c) == c){
            System.out.println(a+b+c*(int)Math.pow(2, k));
        }else if (Math.max(Math.max(a, b), c) == b){
            System.out.println(a+b*(int)Math.pow(2, k)+c);
        }else{
            System.out.println(b+c+a*(int)Math.pow(2, k));
        }
    }
} 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();
        double k = (double)sc.nextInt();


        if (Math.max(Math.max(a,b), c) == c){
            System.out.println(a+b+c*(int)Math.pow(2, k));
        }else if (Math.max(Math.max(a, b), c) == b){
            System.out.println(a+b*(int)Math.pow(2, k)+c);
        }else{
            System.out.println(b+c+a*(int)Math.pow(2, k));
        }
    } main {
        Scanner sc = new Scanner(System.in);

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


        if (Math.max(Math.max(a,b), c) == c){
            System.out.println(a+b+c*(int)Math.pow(2, k));
        }else if (Math.max(Math.max(a, b), c) == b){
            System.out.println(a+b*(int)Math.pow(2, k)+c);
        }else{
            System.out.println(b+c+a*(int)Math.pow(2, k));
        }
    } 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 double k = (double)sc.nextInt(); k (double)sc.nextInt() sc.nextInt sc if (Math.max(Math.max(a,b), c) == c){
            System.out.println(a+b+c*(int)Math.pow(2, k));
        }else if (Math.max(Math.max(a, b), c) == b){
            System.out.println(a+b*(int)Math.pow(2, k)+c);
        }else{
            System.out.println(b+c+a*(int)Math.pow(2, k));
        } Math.max(Math.max(a,b), c) == c Math.max(Math.max(a,b), c) Math.max Math Math.max(a,b) Math.max Math a b c c {
            System.out.println(a+b+c*(int)Math.pow(2, k));
        } System.out.println(a+b+c*(int)Math.pow(2, k)) System.out.println System.out System System.out a+b+c*(int)Math.pow(2, k) a+b+c*(int)Math.pow(2, k) a b c*(int)Math.pow(2, k) c (int)Math.pow(2, k) Math.pow Math 2 k if (Math.max(Math.max(a, b), c) == b){
            System.out.println(a+b*(int)Math.pow(2, k)+c);
        }else{
            System.out.println(b+c+a*(int)Math.pow(2, k));
        } Math.max(Math.max(a, b), c) == b Math.max(Math.max(a, b), c) Math.max Math Math.max(a, b) Math.max Math a b c b {
            System.out.println(a+b*(int)Math.pow(2, k)+c);
        } System.out.println(a+b*(int)Math.pow(2, k)+c) System.out.println System.out System System.out a+b*(int)Math.pow(2, k)+c a+b*(int)Math.pow(2, k)+c a b*(int)Math.pow(2, k) b (int)Math.pow(2, k) Math.pow Math 2 k c {
            System.out.println(b+c+a*(int)Math.pow(2, k));
        } System.out.println(b+c+a*(int)Math.pow(2, k)) System.out.println System.out System System.out b+c+a*(int)Math.pow(2, k) b+c+a*(int)Math.pow(2, k) b c a*(int)Math.pow(2, k) a (int)Math.pow(2, k) Math.pow Math 2 k 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();
        double k = (double)sc.nextInt();


        if (Math.max(Math.max(a,b), c) == c){
            System.out.println(a+b+c*(int)Math.pow(2, k));
        }else if (Math.max(Math.max(a, b), c) == b){
            System.out.println(a+b*(int)Math.pow(2, k)+c);
        }else{
            System.out.println(b+c+a*(int)Math.pow(2, 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();
        double k = (double)sc.nextInt();


        if (Math.max(Math.max(a,b), c) == c){
            System.out.println(a+b+c*(int)Math.pow(2, k));
        }else if (Math.max(Math.max(a, b), c) == b){
            System.out.println(a+b*(int)Math.pow(2, k)+c);
        }else{
            System.out.println(b+c+a*(int)Math.pow(2, k));
        }
    }
} 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();
        double k = (double)sc.nextInt();


        if (Math.max(Math.max(a,b), c) == c){
            System.out.println(a+b+c*(int)Math.pow(2, k));
        }else if (Math.max(Math.max(a, b), c) == b){
            System.out.println(a+b*(int)Math.pow(2, k)+c);
        }else{
            System.out.println(b+c+a*(int)Math.pow(2, k));
        }
    }
}