You are given *n* numbers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>. You can perform at most *k* operations. For each operation you can multiply one of the numbers by *x*. We want to make <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/1faa5be276f646dfb07d2a01bf67449ad72c0ef7.png" style="max-width: 100.0%;max-height: 100.0%;"/> as large as possible, where <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/ddbf6923ea3f08cb83b08ed026f40a80751dff3f.png" style="max-width: 100.0%;max-height: 100.0%;"/> denotes the bitwise OR. 

Find the maximum possible value of <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/1faa5be276f646dfb07d2a01bf67449ad72c0ef7.png" style="max-width: 100.0%;max-height: 100.0%;"/> after performing at most *k* operations optimally.
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 *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (0 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>).
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 14 21:25:50 2019

@author: pawangoyal
"""
input_1=input()
input_1=input_1.split()
n = int(input_1[0])
k = int(input_1[1])
x = int(input_1[2])

a=input()
a=a.split()
a=[int(x) for x in a]
maximum=0
prefix=[]
suffix=[]

prefix_or = 0
suffix_or = 0

for i in range(n):
    prefix_or = prefix_or|a[i]
    prefix.append(prefix_or)

for i in range(n-1,-1,-1):
    suffix_or = suffix_or|a[i]
    suffix.append(suffix_or)
 
or_bit=0

for i in range(n):
   if i == 0:
       or_bit=max(or_bit,(a[0]*(x**k)|suffix[n-2]))
   elif i == (n-1):
       or_bit=max(or_bit,(a[n-1]*(x**k)|prefix[n-2]))
   else:
       or_bit=max(or_bit,(a[i]*(x**k)|prefix[i-1]|suffix[n-2-i]))
   
    
print(or_bit)

