import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
    int k = Integer.parseInt(in.readLine());
    int max = Math.max(Math.max(a,b),c);
    int min = Math.min(Math.min(a,b),c);
    int middle = a+b+c-max-min;
    System.out.println(max*(int)Math.pow(2,k)+min+middle);
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
    int k = Integer.parseInt(in.readLine());
    int max = Math.max(Math.max(a,b),c);
    int min = Math.min(Math.min(a,b),c);
    int middle = a+b+c-max-min;
    System.out.println(max*(int)Math.pow(2,k)+min+middle);
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
    int k = Integer.parseInt(in.readLine());
    int max = Math.max(Math.max(a,b),c);
    int min = Math.min(Math.min(a,b),c);
    int middle = a+b+c-max-min;
    System.out.println(max*(int)Math.pow(2,k)+min+middle);
  } main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
    int k = Integer.parseInt(in.readLine());
    int max = Math.max(Math.max(a,b),c);
    int min = Math.min(Math.min(a,b),c);
    int middle = a+b+c-max-min;
    System.out.println(max*(int)Math.pow(2,k)+min+middle);
  } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String[] str = in.readLine().split(" "); str in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " int a = Integer.parseInt(str[0]); a Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int b = Integer.parseInt(str[1]); b Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 int c = Integer.parseInt(str[2]); c Integer.parseInt(str[2]) Integer.parseInt Integer str[2] str 2 int k = Integer.parseInt(in.readLine()); k Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in int max = Math.max(Math.max(a,b),c); max Math.max(Math.max(a,b),c) Math.max Math Math.max(a,b) Math.max Math a b c int min = Math.min(Math.min(a,b),c); min Math.min(Math.min(a,b),c) Math.min Math Math.min(a,b) Math.min Math a b c int middle = a+b+c-max-min; middle a+b+c-max-min a+b+c-max-min a+b+c a+b+c a b c max min System.out.println(max*(int)Math.pow(2,k)+min+middle) System.out.println System.out System System.out max*(int)Math.pow(2,k)+min+middle max*(int)Math.pow(2,k)+min+middle max*(int)Math.pow(2,k) max (int)Math.pow(2,k) Math.pow Math 2 k min middle String[] args args public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
    int k = Integer.parseInt(in.readLine());
    int max = Math.max(Math.max(a,b),c);
    int min = Math.min(Math.min(a,b),c);
    int middle = a+b+c-max-min;
    System.out.println(max*(int)Math.pow(2,k)+min+middle);
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
    int k = Integer.parseInt(in.readLine());
    int max = Math.max(Math.max(a,b),c);
    int min = Math.min(Math.min(a,b),c);
    int middle = a+b+c-max-min;
    System.out.println(max*(int)Math.pow(2,k)+min+middle);
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
    int k = Integer.parseInt(in.readLine());
    int max = Math.max(Math.max(a,b),c);
    int min = Math.min(Math.min(a,b),c);
    int middle = a+b+c-max-min;
    System.out.println(max*(int)Math.pow(2,k)+min+middle);
  }
}