

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int k = scanner.nextInt();
		int ans = 0;
		int max = 0;
		
		ans = cal(a, b, c, k);
		System.out.println(ans);
		
		
		scanner.close();

	}
	
	public static int cal(int a, int b, int c, int n) {
		int max = 0;
		if (n == 0) {
			return a + b + c;
		}
		max = Math.max(max, cal(a*2, b, c, n-1));
		max = Math.max(max, cal(a, b*2, c, n - 1));
		max = Math.max(max, cal(a, b, c*2, n - 1));
		return max;
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int k = scanner.nextInt();
		int ans = 0;
		int max = 0;
		
		ans = cal(a, b, c, k);
		System.out.println(ans);
		
		
		scanner.close();

	}
	
	public static int cal(int a, int b, int c, int n) {
		int max = 0;
		if (n == 0) {
			return a + b + c;
		}
		max = Math.max(max, cal(a*2, b, c, n-1));
		max = Math.max(max, cal(a, b*2, c, n - 1));
		max = Math.max(max, cal(a, b, c*2, n - 1));
		return max;
	}

} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int k = scanner.nextInt();
		int ans = 0;
		int max = 0;
		
		ans = cal(a, b, c, k);
		System.out.println(ans);
		
		
		scanner.close();

	} main {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int k = scanner.nextInt();
		int ans = 0;
		int max = 0;
		
		ans = cal(a, b, c, k);
		System.out.println(ans);
		
		
		scanner.close();

	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner int c = scanner.nextInt(); c scanner.nextInt() scanner.nextInt scanner int k = scanner.nextInt(); k scanner.nextInt() scanner.nextInt scanner int ans = 0; ans 0 int max = 0; max 0 ans = cal(a, b, c, k) ans cal(a, b, c, k) cal a b c k System.out.println(ans) System.out.println System.out System System.out ans scanner.close() scanner.close scanner String[] args args public static int cal(int a, int b, int c, int n) {
		int max = 0;
		if (n == 0) {
			return a + b + c;
		}
		max = Math.max(max, cal(a*2, b, c, n-1));
		max = Math.max(max, cal(a, b*2, c, n - 1));
		max = Math.max(max, cal(a, b, c*2, n - 1));
		return max;
	} cal {
		int max = 0;
		if (n == 0) {
			return a + b + c;
		}
		max = Math.max(max, cal(a*2, b, c, n-1));
		max = Math.max(max, cal(a, b*2, c, n - 1));
		max = Math.max(max, cal(a, b, c*2, n - 1));
		return max;
	} int max = 0; max 0 if (n == 0) {
			return a + b + c;
		} n == 0 n 0 {
			return a + b + c;
		} return a + b + c; a + b + c a + b + c a b c max = Math.max(max, cal(a*2, b, c, n-1)) max Math.max(max, cal(a*2, b, c, n-1)) Math.max Math max cal(a*2, b, c, n-1) cal a*2 a 2 b c n-1 n 1 max = Math.max(max, cal(a, b*2, c, n - 1)) max Math.max(max, cal(a, b*2, c, n - 1)) Math.max Math max cal(a, b*2, c, n - 1) cal a b*2 b 2 c n - 1 n 1 max = Math.max(max, cal(a, b, c*2, n - 1)) max Math.max(max, cal(a, b, c*2, n - 1)) Math.max Math max cal(a, b, c*2, n - 1) cal a b c*2 c 2 n - 1 n 1 return max; max int a a int b b int c c int n n public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int k = scanner.nextInt();
		int ans = 0;
		int max = 0;
		
		ans = cal(a, b, c, k);
		System.out.println(ans);
		
		
		scanner.close();

	}
	
	public static int cal(int a, int b, int c, int n) {
		int max = 0;
		if (n == 0) {
			return a + b + c;
		}
		max = Math.max(max, cal(a*2, b, c, n-1));
		max = Math.max(max, cal(a, b*2, c, n - 1));
		max = Math.max(max, cal(a, b, c*2, n - 1));
		return max;
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int k = scanner.nextInt();
		int ans = 0;
		int max = 0;
		
		ans = cal(a, b, c, k);
		System.out.println(ans);
		
		
		scanner.close();

	}
	
	public static int cal(int a, int b, int c, int n) {
		int max = 0;
		if (n == 0) {
			return a + b + c;
		}
		max = Math.max(max, cal(a*2, b, c, n-1));
		max = Math.max(max, cal(a, b*2, c, n - 1));
		max = Math.max(max, cal(a, b, c*2, n - 1));
		return max;
	}

} Main


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int k = scanner.nextInt();
		int ans = 0;
		int max = 0;
		
		ans = cal(a, b, c, k);
		System.out.println(ans);
		
		
		scanner.close();

	}
	
	public static int cal(int a, int b, int c, int n) {
		int max = 0;
		if (n == 0) {
			return a + b + c;
		}
		max = Math.max(max, cal(a*2, b, c, n-1));
		max = Math.max(max, cal(a, b*2, c, n - 1));
		max = Math.max(max, cal(a, b, c*2, n - 1));
		return max;
	}

}
