import java.util.Scanner;

public class Main {
	
	public static void main(String... ac) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), k = sc.nextInt();
		
		int max = Math.max(a, Math.max(b, c));
		
		System.out.println(a + b + c + max * ((1 << k) - 1));
		
	}
	
} import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String... ac) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), k = sc.nextInt();
		
		int max = Math.max(a, Math.max(b, c));
		
		System.out.println(a + b + c + max * ((1 << k) - 1));
		
	}
	
} Main public static void main(String... ac) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), k = sc.nextInt();
		
		int max = Math.max(a, Math.max(b, c));
		
		System.out.println(a + b + c + max * ((1 << k) - 1));
		
	} main {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), k = sc.nextInt();
		
		int max = Math.max(a, Math.max(b, c));
		
		System.out.println(a + b + c + max * ((1 << k) - 1));
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt() a sc.nextInt() sc.nextInt sc b = sc.nextInt() b sc.nextInt() sc.nextInt sc c = sc.nextInt() c sc.nextInt() sc.nextInt sc k = sc.nextInt(); k sc.nextInt() sc.nextInt sc int max = Math.max(a, Math.max(b, c)); max Math.max(a, Math.max(b, c)) Math.max Math a Math.max(b, c) Math.max Math b c System.out.println(a + b + c + max * ((1 << k) - 1)) System.out.println System.out System System.out a + b + c + max * ((1 << k) - 1) c a + b + c + max * ((1 << k) - 1) a b c max * ((1 << k) - 1) max ((1 << k) - 1) (1 << k) 1 k 1 String... ac ac public class Main {
	
	public static void main(String... ac) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), k = sc.nextInt();
		
		int max = Math.max(a, Math.max(b, c));
		
		System.out.println(a + b + c + max * ((1 << k) - 1));
		
	}
	
} public class Main {
	
	public static void main(String... ac) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), k = sc.nextInt();
		
		int max = Math.max(a, Math.max(b, c));
		
		System.out.println(a + b + c + max * ((1 << k) - 1));
		
	}
	
} Main
import java.util.Scanner;

public class Main {
	
	public static void main(String... ac) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), k = sc.nextInt();
		
		int max = Math.max(a, Math.max(b, c));
		
		System.out.println(a + b + c + max * ((1 << k) - 1));
		
	}
	
}