import java.util.*;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        PriorityQueue<Long> numbers = new PriorityQueue<>(3,Collections.<Long>reverseOrder());
        for (int i = 0; i < 3; i++) {
            numbers.add(scanner.nextLong());
        }
        int k = scanner.nextInt();

        for (int i = 0; i < k; i++) {
            long max = numbers.poll();
            numbers.add(max*2);
        }

        long ans = 0;
        while (true){
            if (numbers.isEmpty()){
                break;
            }
            ans += numbers.poll();
        }
        System.out.println(ans);
        scanner.close();
    }
} import java.util.*; util.* java import java.util.stream.Stream; Stream java.util.stream public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        PriorityQueue<Long> numbers = new PriorityQueue<>(3,Collections.<Long>reverseOrder());
        for (int i = 0; i < 3; i++) {
            numbers.add(scanner.nextLong());
        }
        int k = scanner.nextInt();

        for (int i = 0; i < k; i++) {
            long max = numbers.poll();
            numbers.add(max*2);
        }

        long ans = 0;
        while (true){
            if (numbers.isEmpty()){
                break;
            }
            ans += numbers.poll();
        }
        System.out.println(ans);
        scanner.close();
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        PriorityQueue<Long> numbers = new PriorityQueue<>(3,Collections.<Long>reverseOrder());
        for (int i = 0; i < 3; i++) {
            numbers.add(scanner.nextLong());
        }
        int k = scanner.nextInt();

        for (int i = 0; i < k; i++) {
            long max = numbers.poll();
            numbers.add(max*2);
        }

        long ans = 0;
        while (true){
            if (numbers.isEmpty()){
                break;
            }
            ans += numbers.poll();
        }
        System.out.println(ans);
        scanner.close();
    } main {
        Scanner scanner = new Scanner(System.in);

        PriorityQueue<Long> numbers = new PriorityQueue<>(3,Collections.<Long>reverseOrder());
        for (int i = 0; i < 3; i++) {
            numbers.add(scanner.nextLong());
        }
        int k = scanner.nextInt();

        for (int i = 0; i < k; i++) {
            long max = numbers.poll();
            numbers.add(max*2);
        }

        long ans = 0;
        while (true){
            if (numbers.isEmpty()){
                break;
            }
            ans += numbers.poll();
        }
        System.out.println(ans);
        scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) PriorityQueue<Long> numbers = new PriorityQueue<>(3,Collections.<Long>reverseOrder()); numbers new PriorityQueue<>(3,Collections.<Long>reverseOrder()) for (int i = 0; i < 3; i++) {
            numbers.add(scanner.nextLong());
        } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
            numbers.add(scanner.nextLong());
        } {
            numbers.add(scanner.nextLong());
        } numbers.add(scanner.nextLong()) numbers.add numbers scanner.nextLong() scanner.nextLong scanner int k = scanner.nextInt(); k scanner.nextInt() scanner.nextInt scanner for (int i = 0; i < k; i++) {
            long max = numbers.poll();
            numbers.add(max*2);
        } int i = 0; int i = 0; i 0 i < k i k i++ i++ i {
            long max = numbers.poll();
            numbers.add(max*2);
        } {
            long max = numbers.poll();
            numbers.add(max*2);
        } long max = numbers.poll(); max numbers.poll() numbers.poll numbers numbers.add(max*2) numbers.add numbers max*2 max 2 long ans = 0; ans 0 while (true){
            if (numbers.isEmpty()){
                break;
            }
            ans += numbers.poll();
        } true {
            if (numbers.isEmpty()){
                break;
            }
            ans += numbers.poll();
        } if (numbers.isEmpty()){
                break;
            } numbers.isEmpty() numbers.isEmpty numbers {
                break;
            } break; ans += numbers.poll() ans numbers.poll() numbers.poll numbers System.out.println(ans) System.out.println System.out System System.out ans scanner.close() scanner.close scanner String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        PriorityQueue<Long> numbers = new PriorityQueue<>(3,Collections.<Long>reverseOrder());
        for (int i = 0; i < 3; i++) {
            numbers.add(scanner.nextLong());
        }
        int k = scanner.nextInt();

        for (int i = 0; i < k; i++) {
            long max = numbers.poll();
            numbers.add(max*2);
        }

        long ans = 0;
        while (true){
            if (numbers.isEmpty()){
                break;
            }
            ans += numbers.poll();
        }
        System.out.println(ans);
        scanner.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        PriorityQueue<Long> numbers = new PriorityQueue<>(3,Collections.<Long>reverseOrder());
        for (int i = 0; i < 3; i++) {
            numbers.add(scanner.nextLong());
        }
        int k = scanner.nextInt();

        for (int i = 0; i < k; i++) {
            long max = numbers.poll();
            numbers.add(max*2);
        }

        long ans = 0;
        while (true){
            if (numbers.isEmpty()){
                break;
            }
            ans += numbers.poll();
        }
        System.out.println(ans);
        scanner.close();
    }
} Main
import java.util.*;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        PriorityQueue<Long> numbers = new PriorityQueue<>(3,Collections.<Long>reverseOrder());
        for (int i = 0; i < 3; i++) {
            numbers.add(scanner.nextLong());
        }
        int k = scanner.nextInt();

        for (int i = 0; i < k; i++) {
            long max = numbers.poll();
            numbers.add(max*2);
        }

        long ans = 0;
        while (true){
            if (numbers.isEmpty()){
                break;
            }
            ans += numbers.poll();
        }
        System.out.println(ans);
        scanner.close();
    }
}
