You are given n numbers a1, a2, ..., an. You can perform at most k operations. For each operation you can multiply one of the numbers by x. We want to make <image> as large as possible, where <image> denotes the bitwise OR. 

Find the maximum possible value of <image> after performing at most k operations optimally.

Input

The first line contains three integers n, k and x (1 ≤ n ≤ 200 000, 1 ≤ k ≤ 10, 2 ≤ x ≤ 8).

The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 109).

Output

Output the maximum value of a bitwise OR of sequence elements after performing operations.

Examples

Input

3 1 2
1 1 1


Output

3


Input

4 2 3
1 2 4 8


Output

79

Note

For the first sample, any possible choice of doing one operation will result the same three numbers 1, 1, 2 so the result is <image>. 

For the second sample if we multiply 8 by 3 two times we'll get 72. In this case the numbers will become 1, 2, 4, 72 so the OR value will be 79 and is the largest possible result.
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Artem Gilmudinov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Reader in = new Reader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Reader in, PrintWriter out) {
            int n, k, x;
            n = in.ni();
            k = in.ni();
            x = in.ni();
            int[] bits = new int[31];
            int[] a = new int[n];
            Helper.fillIntArray(in, a);
            ArrayList<ArrayList<Integer>> binary = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                ArrayList<Integer> list = getBits(a[i]);
                binary.add(list);
                for (Integer bit : list) {
                    ++bits[bit];
                }
            }
            long res = 0;
            int[] bitsTemp = new int[31];
            for (int i = 0; i < n; i++) {
                long val = a[i];
                System.arraycopy(bits, 0, bitsTemp, 0, 31);
                for (Integer bit : binary.get(i)) {
                    --bitsTemp[bit];
                }
                val *= Utils.binpow(x, k, Long.MAX_VALUE);
                for (int j = 0; j < 31; j++) {
                    if (bitsTemp[j] != 0) {
                        val |= (1 << j);
                    }
                }
                res = Math.max(res, val);
            }
            out.println(res);
        }

        public ArrayList<Integer> getBits(int x) {
            ArrayList<Integer> ans = new ArrayList<>();
            for (int i = 0; i <= 30; i++) {
                if ((x & (1 << i)) != 0) {
                    ans.add(i);
                }
            }
            return ans;
        }

    }

    static class Helper {
        public static void fillIntArray(Reader in, int[] a) {
            for (int i = 0; i < a.length; i++) {
                a[i] = in.ni();
            }
        }

    }

    static class Reader {
        private BufferedReader in;
        private StringTokenizer st = new StringTokenizer("");
        private String delim = " ";

        public Reader(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            if (!st.hasMoreTokens()) {
                st = new StringTokenizer(rl());
            }
            return st.nextToken(delim);
        }

        public String rl() {
            try {
                return in.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int ni() {
            return Integer.parseInt(next());
        }

    }

    static class Utils {
        public static long binpow(long a, long pow, long mod) {
            if (pow == 0) {
                return 1;
            }
            long res = binpow(a, pow / 2, mod);
            if (pow % 2 == 0) {
                return (res * res) % mod;
            } else {
                return (((res * res) % mod) * a) % mod;
            }
        }

    }
}

