import java.io.IOException;

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

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            String s = reader.readLine();

            final String[] sl = s.split(" ");

            s = reader.readLine();
            int K = Integer.parseInt(s);

            int mx = 0;
            int sm = 0;
            for (int i = 0; i < sl.length; i++) {
                int tmp = Integer.parseInt(sl[i]);
                if (mx < tmp) mx = tmp;
                sm += tmp;
            }

            System.out.println(sm - mx + (int)Math.pow(2, K) * mx);
        }
    }
} import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            String s = reader.readLine();

            final String[] sl = s.split(" ");

            s = reader.readLine();
            int K = Integer.parseInt(s);

            int mx = 0;
            int sm = 0;
            for (int i = 0; i < sl.length; i++) {
                int tmp = Integer.parseInt(sl[i]);
                if (mx < tmp) mx = tmp;
                sm += tmp;
            }

            System.out.println(sm - mx + (int)Math.pow(2, K) * mx);
        }
    }
} Main public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            String s = reader.readLine();

            final String[] sl = s.split(" ");

            s = reader.readLine();
            int K = Integer.parseInt(s);

            int mx = 0;
            int sm = 0;
            for (int i = 0; i < sl.length; i++) {
                int tmp = Integer.parseInt(sl[i]);
                if (mx < tmp) mx = tmp;
                sm += tmp;
            }

            System.out.println(sm - mx + (int)Math.pow(2, K) * mx);
        }
    } main {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            String s = reader.readLine();

            final String[] sl = s.split(" ");

            s = reader.readLine();
            int K = Integer.parseInt(s);

            int mx = 0;
            int sm = 0;
            for (int i = 0; i < sl.length; i++) {
                int tmp = Integer.parseInt(sl[i]);
                if (mx < tmp) mx = tmp;
                sm += tmp;
            }

            System.out.println(sm - mx + (int)Math.pow(2, K) * mx);
        }
    } try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            String s = reader.readLine();

            final String[] sl = s.split(" ");

            s = reader.readLine();
            int K = Integer.parseInt(s);

            int mx = 0;
            int sm = 0;
            for (int i = 0; i < sl.length; i++) {
                int tmp = Integer.parseInt(sl[i]);
                if (mx < tmp) mx = tmp;
                sm += tmp;
            }

            System.out.println(sm - mx + (int)Math.pow(2, K) * mx);
        } {
            String s = reader.readLine();

            final String[] sl = s.split(" ");

            s = reader.readLine();
            int K = Integer.parseInt(s);

            int mx = 0;
            int sm = 0;
            for (int i = 0; i < sl.length; i++) {
                int tmp = Integer.parseInt(sl[i]);
                if (mx < tmp) mx = tmp;
                sm += tmp;
            }

            System.out.println(sm - mx + (int)Math.pow(2, K) * mx);
        } BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) new BufferedReader(
                new InputStreamReader(System.in)) String s = reader.readLine(); s reader.readLine() reader.readLine reader final String[] sl = s.split(" "); sl s.split(" ") s.split s " " s = reader.readLine() s reader.readLine() reader.readLine reader int K = Integer.parseInt(s); K Integer.parseInt(s) Integer.parseInt Integer s int mx = 0; mx 0 int sm = 0; sm 0 for (int i = 0; i < sl.length; i++) {
                int tmp = Integer.parseInt(sl[i]);
                if (mx < tmp) mx = tmp;
                sm += tmp;
            } int i = 0; int i = 0; i 0 i < sl.length i sl.length sl sl.length i++ i++ i {
                int tmp = Integer.parseInt(sl[i]);
                if (mx < tmp) mx = tmp;
                sm += tmp;
            } {
                int tmp = Integer.parseInt(sl[i]);
                if (mx < tmp) mx = tmp;
                sm += tmp;
            } int tmp = Integer.parseInt(sl[i]); tmp Integer.parseInt(sl[i]) Integer.parseInt Integer sl[i] sl i if (mx < tmp) mx = tmp; mx < tmp mx tmp mx = tmp mx tmp sm += tmp sm tmp System.out.println(sm - mx + (int)Math.pow(2, K) * mx) System.out.println System.out System System.out sm - mx + (int)Math.pow(2, K) * mx sm - mx sm mx (int)Math.pow(2, K) * mx (int)Math.pow(2, K) Math.pow Math 2 K mx String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            String s = reader.readLine();

            final String[] sl = s.split(" ");

            s = reader.readLine();
            int K = Integer.parseInt(s);

            int mx = 0;
            int sm = 0;
            for (int i = 0; i < sl.length; i++) {
                int tmp = Integer.parseInt(sl[i]);
                if (mx < tmp) mx = tmp;
                sm += tmp;
            }

            System.out.println(sm - mx + (int)Math.pow(2, K) * mx);
        }
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            String s = reader.readLine();

            final String[] sl = s.split(" ");

            s = reader.readLine();
            int K = Integer.parseInt(s);

            int mx = 0;
            int sm = 0;
            for (int i = 0; i < sl.length; i++) {
                int tmp = Integer.parseInt(sl[i]);
                if (mx < tmp) mx = tmp;
                sm += tmp;
            }

            System.out.println(sm - mx + (int)Math.pow(2, K) * mx);
        }
    }
} Main
import java.io.IOException;

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

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            String s = reader.readLine();

            final String[] sl = s.split(" ");

            s = reader.readLine();
            int K = Integer.parseInt(s);

            int mx = 0;
            int sm = 0;
            for (int i = 0; i < sl.length; i++) {
                int tmp = Integer.parseInt(sl[i]);
                if (mx < tmp) mx = tmp;
                sm += tmp;
            }

            System.out.println(sm - mx + (int)Math.pow(2, K) * mx);
        }
    }
}
