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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int max = 0;
		ArrayList<Integer> numbers = new ArrayList<>();
		for(int i =0;i<4;i++){
			numbers.add(sc.nextInt());
		}
		for(int i =0;i<3;i++){
			max = Math.max(max, numbers.get(i));
		}
		numbers.set(numbers.indexOf(max), max*(int)Math.pow(2, numbers.get(3)));
		int sum = 0;
		for(int i =0;i<3;i++){
			sum += numbers.get(i);
		}
		System.out.println(sum);
	}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int max = 0;
		ArrayList<Integer> numbers = new ArrayList<>();
		for(int i =0;i<4;i++){
			numbers.add(sc.nextInt());
		}
		for(int i =0;i<3;i++){
			max = Math.max(max, numbers.get(i));
		}
		numbers.set(numbers.indexOf(max), max*(int)Math.pow(2, numbers.get(3)));
		int sum = 0;
		for(int i =0;i<3;i++){
			sum += numbers.get(i);
		}
		System.out.println(sum);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int max = 0;
		ArrayList<Integer> numbers = new ArrayList<>();
		for(int i =0;i<4;i++){
			numbers.add(sc.nextInt());
		}
		for(int i =0;i<3;i++){
			max = Math.max(max, numbers.get(i));
		}
		numbers.set(numbers.indexOf(max), max*(int)Math.pow(2, numbers.get(3)));
		int sum = 0;
		for(int i =0;i<3;i++){
			sum += numbers.get(i);
		}
		System.out.println(sum);
	} main {
		Scanner sc = new Scanner(System.in);
		int max = 0;
		ArrayList<Integer> numbers = new ArrayList<>();
		for(int i =0;i<4;i++){
			numbers.add(sc.nextInt());
		}
		for(int i =0;i<3;i++){
			max = Math.max(max, numbers.get(i));
		}
		numbers.set(numbers.indexOf(max), max*(int)Math.pow(2, numbers.get(3)));
		int sum = 0;
		for(int i =0;i<3;i++){
			sum += numbers.get(i);
		}
		System.out.println(sum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int max = 0; max 0 ArrayList<Integer> numbers = new ArrayList<>(); numbers new ArrayList<>() for(int i =0;i<4;i++){
			numbers.add(sc.nextInt());
		} int i =0; int i =0; i 0 i<4 i 4 i++ i++ i {
			numbers.add(sc.nextInt());
		} {
			numbers.add(sc.nextInt());
		} numbers.add(sc.nextInt()) numbers.add numbers sc.nextInt() sc.nextInt sc for(int i =0;i<3;i++){
			max = Math.max(max, numbers.get(i));
		} int i =0; int i =0; i 0 i<3 i 3 i++ i++ i {
			max = Math.max(max, numbers.get(i));
		} {
			max = Math.max(max, numbers.get(i));
		} max = Math.max(max, numbers.get(i)) max Math.max(max, numbers.get(i)) Math.max Math max numbers.get(i) numbers.get numbers i numbers.set(numbers.indexOf(max), max*(int)Math.pow(2, numbers.get(3))) numbers.set numbers numbers.indexOf(max) numbers.indexOf numbers max max*(int)Math.pow(2, numbers.get(3)) max (int)Math.pow(2, numbers.get(3)) Math.pow Math 2 numbers.get(3) numbers.get numbers 3 int sum = 0; sum 0 for(int i =0;i<3;i++){
			sum += numbers.get(i);
		} int i =0; int i =0; i 0 i<3 i 3 i++ i++ i {
			sum += numbers.get(i);
		} {
			sum += numbers.get(i);
		} sum += numbers.get(i) sum numbers.get(i) numbers.get numbers i System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int max = 0;
		ArrayList<Integer> numbers = new ArrayList<>();
		for(int i =0;i<4;i++){
			numbers.add(sc.nextInt());
		}
		for(int i =0;i<3;i++){
			max = Math.max(max, numbers.get(i));
		}
		numbers.set(numbers.indexOf(max), max*(int)Math.pow(2, numbers.get(3)));
		int sum = 0;
		for(int i =0;i<3;i++){
			sum += numbers.get(i);
		}
		System.out.println(sum);
	}

} public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int max = 0;
		ArrayList<Integer> numbers = new ArrayList<>();
		for(int i =0;i<4;i++){
			numbers.add(sc.nextInt());
		}
		for(int i =0;i<3;i++){
			max = Math.max(max, numbers.get(i));
		}
		numbers.set(numbers.indexOf(max), max*(int)Math.pow(2, numbers.get(3)));
		int sum = 0;
		for(int i =0;i<3;i++){
			sum += numbers.get(i);
		}
		System.out.println(sum);
	}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int max = 0;
		ArrayList<Integer> numbers = new ArrayList<>();
		for(int i =0;i<4;i++){
			numbers.add(sc.nextInt());
		}
		for(int i =0;i<3;i++){
			max = Math.max(max, numbers.get(i));
		}
		numbers.set(numbers.indexOf(max), max*(int)Math.pow(2, numbers.get(3)));
		int sum = 0;
		for(int i =0;i<3;i++){
			sum += numbers.get(i);
		}
		System.out.println(sum);
	}

}
