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>).
def bt(bit,n):
    lt=bit.copy()
    for i in range(70):
        if (1<<i)&n:
            lt[i]+=1
    return lt.copy()
def nbitsub(bit,n):
    lt=bit.copy()
    for i in range(70):
        if (1 << i) & n:
            lt[i] -= 1
    return lt.copy()

def get_or(bit):
    res=0
    for i in range(0,len(bit)):
        if bit[i]:
            res+=(1<<i)
    return res
# print(get_or([0,1,0,1]))
def f(a,k,x):
    bit=[0]*70
    for i in a:
        bit=bt(bit,i)
    goodcnt=[0]*(len(a))
    # print(bit)
    for val in range(k):
        cmax=get_or(bit)
        cind=0
        cnt1=0
        cbit=bit.copy()
        for num in range(len(a)):
            tbit=nbitsub(bit,a[num])
            # print(tbit)
            a[num]*=x
            tbit=bt(tbit,a[num])
            tor=get_or(tbit)
            # print(tor,cmax)
            if tor>cmax:
                cind=num
                cmax=tor
                cbit=tbit.copy()

            # for i in range(30-1,-1,-1):
            #     if bit[i]==0 and tbit[i]==1:
            #         if i >cmax:
            #             cmax=i
            #             cind=num
            #             break
            a[num]//=x
        a[cind]*=x
        # print(a)
        bit=cbit.copy()
    # print(cmax)
    # print(get_or(bit),bit)
    return get_or(bit)

n,k,x=map(int,input().strip().split())
a=list(map(int,input().strip().split()))
print(f(a,k,x))