import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List <Integer> list = new ArrayList<>(Arrays.asList(sc.nextInt(),sc.nextInt(),sc.nextInt()));
    Collections.sort(list);
    System.out.println((int)(list.get(0) + list.get(1) + list.get(2) * Math.pow(2, sc.nextInt())));
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List <Integer> list = new ArrayList<>(Arrays.asList(sc.nextInt(),sc.nextInt(),sc.nextInt()));
    Collections.sort(list);
    System.out.println((int)(list.get(0) + list.get(1) + list.get(2) * Math.pow(2, sc.nextInt())));
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List <Integer> list = new ArrayList<>(Arrays.asList(sc.nextInt(),sc.nextInt(),sc.nextInt()));
    Collections.sort(list);
    System.out.println((int)(list.get(0) + list.get(1) + list.get(2) * Math.pow(2, sc.nextInt())));
  } main {
    Scanner sc = new Scanner(System.in);
    List <Integer> list = new ArrayList<>(Arrays.asList(sc.nextInt(),sc.nextInt(),sc.nextInt()));
    Collections.sort(list);
    System.out.println((int)(list.get(0) + list.get(1) + list.get(2) * Math.pow(2, sc.nextInt())));
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) List <Integer> list = new ArrayList<>(Arrays.asList(sc.nextInt(),sc.nextInt(),sc.nextInt())); list new ArrayList<>(Arrays.asList(sc.nextInt(),sc.nextInt(),sc.nextInt())) Collections.sort(list) Collections.sort Collections list System.out.println((int)(list.get(0) + list.get(1) + list.get(2) * Math.pow(2, sc.nextInt()))) System.out.println System.out System System.out (int)(list.get(0) + list.get(1) + list.get(2) * Math.pow(2, sc.nextInt())) list.get(0) + list.get(1) + list.get(2) * Math.pow(2, sc.nextInt()) list.get(0) list.get list 0 list.get(1) list.get list 1 list.get(2) * Math.pow(2, sc.nextInt()) list.get(2) list.get list 2 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);
    List <Integer> list = new ArrayList<>(Arrays.asList(sc.nextInt(),sc.nextInt(),sc.nextInt()));
    Collections.sort(list);
    System.out.println((int)(list.get(0) + list.get(1) + list.get(2) * Math.pow(2, sc.nextInt())));
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List <Integer> list = new ArrayList<>(Arrays.asList(sc.nextInt(),sc.nextInt(),sc.nextInt()));
    Collections.sort(list);
    System.out.println((int)(list.get(0) + list.get(1) + list.get(2) * Math.pow(2, sc.nextInt())));
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List <Integer> list = new ArrayList<>(Arrays.asList(sc.nextInt(),sc.nextInt(),sc.nextInt()));
    Collections.sort(list);
    System.out.println((int)(list.get(0) + list.get(1) + list.get(2) * Math.pow(2, sc.nextInt())));
  }
}