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.*;
import java.util.*;

public class cf579d implements Runnable {
	public static final String taskname = cf579d.class.getName();
	
	public StringTokenizer strtok;
	public BufferedReader inr;
	public PrintWriter out;

	public static void main(String[] args) {
		new Thread(new cf579d()).start();
	}

	public void run() {
		Locale.setDefault(Locale.US);
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		try {
			inr = new BufferedReader(oj ? new InputStreamReader(System.in, "ISO-8859-1") : new FileReader(taskname + ".in"));
			out = new PrintWriter(oj ? new OutputStreamWriter(System.out, "ISO-8859-1") : new FileWriter(taskname + ".out"));
			solve();
		} catch (Exception e) {
			if (!oj)
				e.printStackTrace();
			System.exit(9000);
		} finally {
			out.flush();
			out.close();
		}
	}

	public String nextToken() throws IOException {
		while (strtok == null || !strtok.hasMoreTokens()) {
			strtok = new StringTokenizer(inr.readLine());
		}
		return strtok.nextToken();
	}

	public int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

	// Solution
	
	public int bitLength(long v) {
		int result = 0;
		while (v > 0) {
			result++;
			v >>= 1;
		}
		return result;
	}
	
	public void addval(long v, int[] or) {
		for (int j = 0; v > 0; j++) {
			if ((v & 1) == 1) {
				or[j]++;
			}
			v >>= 1;
		}
	}
	
	public void remval(long v, int[] or) {
		for (int j = 0; v > 0; j++) {
			if ((v & 1) == 1) {
				or[j]--;
			}
			v >>= 1;
		}
	}

	public void solve() throws NumberFormatException, IOException {
		long n = nextLong(), k = nextLong(), x = nextLong();
		ArrayList<Long> a = new ArrayList<Long>((int)n);
		for (int i = 0; i < n; i++) {
			a.add(nextLong());
		}
		Collections.sort(a);
		int[] or = new int[64];
		for (long v : a) {
			addval(v, or);
		}
		long best = 0;
		long xp = 1;
		for (int i = 0; i < k; i++) {
			xp *= x;
		}
		int maxLength = bitLength(a.get(a.size() - 1));
		for (int i = a.size() - 1; i >= 0; i--) {
			remval(a.get(i), or);
			addval(a.get(i) * xp, or);
			long current = 0;
			for (int s = 63; s >= 0; s--) {
				current <<= 1;
				if (or[s] > 0) {
					current |= 1;
				}
			}
			if (current > best) {
				best = current;
			}
			remval(a.get(i) * xp, or);
			addval(a.get(i), or);
		}
		out.print(best);
	}
}