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.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList


public class R320_Div2_D
{	
	FastReader in;
	PrintWriter out;
	
	public static void main(String[] args)  {
		new R320_Div2_D().run();
	}
	
	void run()
	{		
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}
	
	void solve()
	{
		int n = in.nextInt();
		int k = in.nextInt();
		int x = in.nextInt();
		
		long[] a = new long[n];
		long maxh = 0;
		for (int i = 0; i < n; i++) 
		{
			a[i] = in.nextInt();
			long h = Long.highestOneBit(a[i]);
			if (h > maxh)
				maxh = h;
		}
		
		ArrayList<Integer> ind = new ArrayList<Integer>();
		for (int i = 0; i < n; i++)
			if (Long.highestOneBit(a[i]) == maxh || n < 100)
				ind.add(i);

		int[] bit = new int[64];
		int[] bitCopy = new int[64];
		for (int i = 0; i < n; i++)
		{
			long temp = a[i];		
			for (int j = 0; j < 64; j++)
			{
				long b = temp & 1L;
				bit[j]+= b;
				temp = temp >> 1;
			}
		}
		for (int jj = 0; jj < 64; jj++)
			bitCopy[jj] = bit[jj];
		
		long max = 0;
		for (int j = 0; j < ind.size(); j++)
		{
			for (int jj = 0; jj < 64; jj++)
				bit[jj] = bitCopy[jj];
			
			int aInd = ind.get(j);
			long temp = a[aInd];
			//subtract
			for (int jj = 0; jj < 64; jj++)
			{
				long b = temp & 1L;
				bit[jj]-= b;
				temp = temp >> 1;
			}
			temp = a[aInd];
			for (int i = 0; i < k; i++)
				temp *= x;
			
			for (int jj = 0; jj < 64; jj++)
			{
				long b = temp & 1L;
				bit[jj]+= b;
				temp = temp >> 1;
			}
			
			long bitOr = 0;	
			for (int i = 63; i >= 0; i--)
				if (bit[i] > 0)
					bitOr = bitOr * 2 + 1;
				else
					bitOr *= 2;
			
			if (bitOr > max) max = bitOr;
		}
		
		out.println(max);		
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		} 
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}
	
	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;
	    
	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}
	    
	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }	    
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}
