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.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	private final int BIT = 33;

	public void solve() {
		FastScanner scanner = new FastScanner();
		int N = scanner.nextInt();
		int K = scanner.nextInt();
		long X = scanner.nextLong();

		long Y = 1;
		for (int i = 0; i < K; i++) {
			Y *= X;
		}

		long[] a = new long[N];
		long OR = 0;
		for (int i = 0; i < N; i++) {
			a[i] = scanner.nextLong();
			OR |= a[i];
		}

		boolean[][] check = new boolean[N][BIT];
		int[] cnt = new int[BIT];
		for (int i = 0; i < N; i++) {
			for (int p = 0; p < BIT; p++) {
				if (((a[i] >> p) & 1) != 0) {
					check[i][p] = true;
					cnt[p]++;
				}
			}
		}
		long ans = 0;
		for (int i = 0; i < N; i++) {
			long tmpOR = OR;
			for (int p = 0; p < BIT; p++) {
				if (check[i][p] && cnt[p] == 1) {
					tmpOR ^= (1 << p);
				}
			}
			ans = Math.max(ans, tmpOR | (a[i] * Y));
		}
		System.out.println(ans);
	}

	public static void main(String[] args) {
		new Main().solve();
	}
}

class Edge implements Comparable<Edge> {
	int a, b, strength;

	public Edge(int a, int b, int s) {
		this.a = a;
		this.b = b;
		this.strength = s;
	}

	@Override
	public int compareTo(Edge o) {
		return o.strength - this.strength;
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public int nextInt() {
		return (int) nextLong();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}