
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int sum = 0;
		int max = 0;
		for(int i = 0; i < 3; i++){
			int n = sc.nextInt();
			if(max < n) {
				sum += max;
				max = n;
			}else sum += n;
		}
		System.out.println((int)(sum + max * Math.pow(2, sc.nextInt())));
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int sum = 0;
		int max = 0;
		for(int i = 0; i < 3; i++){
			int n = sc.nextInt();
			if(max < n) {
				sum += max;
				max = n;
			}else sum += n;
		}
		System.out.println((int)(sum + max * Math.pow(2, sc.nextInt())));
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int sum = 0;
		int max = 0;
		for(int i = 0; i < 3; i++){
			int n = sc.nextInt();
			if(max < n) {
				sum += max;
				max = n;
			}else sum += n;
		}
		System.out.println((int)(sum + max * Math.pow(2, sc.nextInt())));
	} main {
		Scanner sc = new Scanner(System.in);
		int sum = 0;
		int max = 0;
		for(int i = 0; i < 3; i++){
			int n = sc.nextInt();
			if(max < n) {
				sum += max;
				max = n;
			}else sum += n;
		}
		System.out.println((int)(sum + max * Math.pow(2, sc.nextInt())));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int sum = 0; sum 0 int max = 0; max 0 for(int i = 0; i < 3; i++){
			int n = sc.nextInt();
			if(max < n) {
				sum += max;
				max = n;
			}else sum += n;
		} int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
			int n = sc.nextInt();
			if(max < n) {
				sum += max;
				max = n;
			}else sum += n;
		} {
			int n = sc.nextInt();
			if(max < n) {
				sum += max;
				max = n;
			}else sum += n;
		} int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc if(max < n) {
				sum += max;
				max = n;
			}else sum += n; max < n max n {
				sum += max;
				max = n;
			} sum += max sum max max = n max n sum += n sum n System.out.println((int)(sum + max * Math.pow(2, sc.nextInt()))) System.out.println System.out System System.out (int)(sum + max * Math.pow(2, sc.nextInt())) sum max * Math.pow(2, sc.nextInt()) max Math.pow(2, sc.nextInt()) Math.pow Math 2 sc.nextInt() sc.nextInt sc String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int sum = 0;
		int max = 0;
		for(int i = 0; i < 3; i++){
			int n = sc.nextInt();
			if(max < n) {
				sum += max;
				max = n;
			}else sum += n;
		}
		System.out.println((int)(sum + max * Math.pow(2, sc.nextInt())));
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int sum = 0;
		int max = 0;
		for(int i = 0; i < 3; i++){
			int n = sc.nextInt();
			if(max < n) {
				sum += max;
				max = n;
			}else sum += n;
		}
		System.out.println((int)(sum + max * Math.pow(2, sc.nextInt())));
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int sum = 0;
		int max = 0;
		for(int i = 0; i < 3; i++){
			int n = sc.nextInt();
			if(max < n) {
				sum += max;
				max = n;
			}else sum += n;
		}
		System.out.println((int)(sum + max * Math.pow(2, sc.nextInt())));
	}
}
