import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String abc = sc.nextLine();
		int k = Integer.parseInt(sc.nextLine());

		int max = 0;
		int ans = 0;
		for (String s : abc.split(" ")) {
			int i = Integer.parseInt(s);
			if (i > max) {
				ans += max;
				max = i;
			} else {
				ans += i;
			}
		}

		System.out.println(ans + max * ((int) Math.pow(2, k)));

		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String abc = sc.nextLine();
		int k = Integer.parseInt(sc.nextLine());

		int max = 0;
		int ans = 0;
		for (String s : abc.split(" ")) {
			int i = Integer.parseInt(s);
			if (i > max) {
				ans += max;
				max = i;
			} else {
				ans += i;
			}
		}

		System.out.println(ans + max * ((int) Math.pow(2, k)));

		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String abc = sc.nextLine();
		int k = Integer.parseInt(sc.nextLine());

		int max = 0;
		int ans = 0;
		for (String s : abc.split(" ")) {
			int i = Integer.parseInt(s);
			if (i > max) {
				ans += max;
				max = i;
			} else {
				ans += i;
			}
		}

		System.out.println(ans + max * ((int) Math.pow(2, k)));

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String abc = sc.nextLine();
		int k = Integer.parseInt(sc.nextLine());

		int max = 0;
		int ans = 0;
		for (String s : abc.split(" ")) {
			int i = Integer.parseInt(s);
			if (i > max) {
				ans += max;
				max = i;
			} else {
				ans += i;
			}
		}

		System.out.println(ans + max * ((int) Math.pow(2, k)));

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String abc = sc.nextLine(); abc sc.nextLine() sc.nextLine sc int k = Integer.parseInt(sc.nextLine()); k Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int max = 0; max 0 int ans = 0; ans 0 for (String s : abc.split(" ")) {
			int i = Integer.parseInt(s);
			if (i > max) {
				ans += max;
				max = i;
			} else {
				ans += i;
			}
		} String s abc.split(" ") abc.split abc " " {
			int i = Integer.parseInt(s);
			if (i > max) {
				ans += max;
				max = i;
			} else {
				ans += i;
			}
		} {
			int i = Integer.parseInt(s);
			if (i > max) {
				ans += max;
				max = i;
			} else {
				ans += i;
			}
		} int i = Integer.parseInt(s); i Integer.parseInt(s) Integer.parseInt Integer s if (i > max) {
				ans += max;
				max = i;
			} else {
				ans += i;
			} i > max i max {
				ans += max;
				max = i;
			} ans += max ans max max = i max i {
				ans += i;
			} ans += i ans i System.out.println(ans + max * ((int) Math.pow(2, k))) System.out.println System.out System System.out ans + max * ((int) Math.pow(2, k)) ans max * ((int) Math.pow(2, k)) max ((int) Math.pow(2, k)) Math.pow Math 2 k sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String abc = sc.nextLine();
		int k = Integer.parseInt(sc.nextLine());

		int max = 0;
		int ans = 0;
		for (String s : abc.split(" ")) {
			int i = Integer.parseInt(s);
			if (i > max) {
				ans += max;
				max = i;
			} else {
				ans += i;
			}
		}

		System.out.println(ans + max * ((int) Math.pow(2, k)));

		sc.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String abc = sc.nextLine();
		int k = Integer.parseInt(sc.nextLine());

		int max = 0;
		int ans = 0;
		for (String s : abc.split(" ")) {
			int i = Integer.parseInt(s);
			if (i > max) {
				ans += max;
				max = i;
			} else {
				ans += i;
			}
		}

		System.out.println(ans + max * ((int) Math.pow(2, k)));

		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String abc = sc.nextLine();
		int k = Integer.parseInt(sc.nextLine());

		int max = 0;
		int ans = 0;
		for (String s : abc.split(" ")) {
			int i = Integer.parseInt(s);
			if (i > max) {
				ans += max;
				max = i;
			} else {
				ans += i;
			}
		}

		System.out.println(ans + max * ((int) Math.pow(2, k)));

		sc.close();
	}
}