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();

			if(a <b) {
				if(b<c) {
					K(c,a,b,k);
				}else {
					K(b,a,c,k);
				}
			}else {
				if(c<a) {
					K(a,b,c,k);
				}else {
					K(c,a,b,k);
				}
			}
	}
	public static void K(int x,int y,int z,int k) {
		for(int j = 0; j<k ;j++) {
			x +=x;
		}
		System.out.println(x+y+z);
	}
} 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();

			if(a <b) {
				if(b<c) {
					K(c,a,b,k);
				}else {
					K(b,a,c,k);
				}
			}else {
				if(c<a) {
					K(a,b,c,k);
				}else {
					K(c,a,b,k);
				}
			}
	}
	public static void K(int x,int y,int z,int k) {
		for(int j = 0; j<k ;j++) {
			x +=x;
		}
		System.out.println(x+y+z);
	}
} 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();

			if(a <b) {
				if(b<c) {
					K(c,a,b,k);
				}else {
					K(b,a,c,k);
				}
			}else {
				if(c<a) {
					K(a,b,c,k);
				}else {
					K(c,a,b,k);
				}
			}
	} main {
		Scanner sc = new Scanner(System.in);
	
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int k = sc.nextInt();

			if(a <b) {
				if(b<c) {
					K(c,a,b,k);
				}else {
					K(b,a,c,k);
				}
			}else {
				if(c<a) {
					K(a,b,c,k);
				}else {
					K(c,a,b,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 int k = sc.nextInt(); k sc.nextInt() sc.nextInt sc if(a <b) {
				if(b<c) {
					K(c,a,b,k);
				}else {
					K(b,a,c,k);
				}
			}else {
				if(c<a) {
					K(a,b,c,k);
				}else {
					K(c,a,b,k);
				}
			} a <b a b {
				if(b<c) {
					K(c,a,b,k);
				}else {
					K(b,a,c,k);
				}
			} if(b<c) {
					K(c,a,b,k);
				}else {
					K(b,a,c,k);
				} b<c b c {
					K(c,a,b,k);
				} K(c,a,b,k) K c a b k {
					K(b,a,c,k);
				} K(b,a,c,k) K b a c k {
				if(c<a) {
					K(a,b,c,k);
				}else {
					K(c,a,b,k);
				}
			} if(c<a) {
					K(a,b,c,k);
				}else {
					K(c,a,b,k);
				} c<a c a {
					K(a,b,c,k);
				} K(a,b,c,k) K a b c k {
					K(c,a,b,k);
				} K(c,a,b,k) K c a b k String[] args args public static void K(int x,int y,int z,int k) {
		for(int j = 0; j<k ;j++) {
			x +=x;
		}
		System.out.println(x+y+z);
	} K {
		for(int j = 0; j<k ;j++) {
			x +=x;
		}
		System.out.println(x+y+z);
	} for(int j = 0; j<k ;j++) {
			x +=x;
		} int j = 0; int j = 0; j 0 j<k j k j++ j++ j {
			x +=x;
		} {
			x +=x;
		} x +=x x x System.out.println(x+y+z) System.out.println System.out System System.out x+y+z x+y+z x y z int x x int y y int z z 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();

			if(a <b) {
				if(b<c) {
					K(c,a,b,k);
				}else {
					K(b,a,c,k);
				}
			}else {
				if(c<a) {
					K(a,b,c,k);
				}else {
					K(c,a,b,k);
				}
			}
	}
	public static void K(int x,int y,int z,int k) {
		for(int j = 0; j<k ;j++) {
			x +=x;
		}
		System.out.println(x+y+z);
	}
} 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();

			if(a <b) {
				if(b<c) {
					K(c,a,b,k);
				}else {
					K(b,a,c,k);
				}
			}else {
				if(c<a) {
					K(a,b,c,k);
				}else {
					K(c,a,b,k);
				}
			}
	}
	public static void K(int x,int y,int z,int k) {
		for(int j = 0; j<k ;j++) {
			x +=x;
		}
		System.out.println(x+y+z);
	}
} 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();

			if(a <b) {
				if(b<c) {
					K(c,a,b,k);
				}else {
					K(b,a,c,k);
				}
			}else {
				if(c<a) {
					K(a,b,c,k);
				}else {
					K(c,a,b,k);
				}
			}
	}
	public static void K(int x,int y,int z,int k) {
		for(int j = 0; j<k ;j++) {
			x +=x;
		}
		System.out.println(x+y+z);
	}
}
