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>).
import time
from collections import defaultdict
import sys
def get_ints(): return list(map(int, sys.stdin.readline().strip().split()))

def solve(N, K, X, A):
    vis = defaultdict(int)
    for a in A:
        k = 0
        while a:
            if a & 1:
                vis[k] += 1
            a //= 2
            k += 1

    last_val = 0
    for k in vis:
        if vis[k] > 0:
            last_val += 2 ** k

    def cal(a, vis, val):
        k = 0
        while a:
            if a & 1:
                vis[k] += val
            a //= 2
            k += 1

    ans = 0
    for _ in range(K):
        max_val, max_idx = -1, -1
        temp_vis = set()
        for i in range(N):
            if A[i] in temp_vis:
                continue

            temp_vis.add(A[i])
            temp_val = last_val
            a = A[i]
            next_a = A[i] * X

            S = "{0:b}".format(a)[::-1]
            next_S = "{0:b}".format(next_a)[::-1]
            for j in range(0, len(next_S), 1):
                v = 0
                if j < len(S) and S[j] == "1":
                    v -= 1
                if next_S[j] == "1":
                    v += 1

                if v < 0 and vis[j] <= 1:
                    temp_val -= 2 ** j

                elif v > 0 and vis[j] == 0:
                    temp_val += 2 ** j

            if temp_val > max_val:
                max_val = temp_val
                max_idx = i
                ans = max(ans, max_val)

        last_val = max_val
        cal(A[max_idx], vis, -1)
        cal(A[max_idx] * X, vis, 1)
        A[max_idx] *= X

    return ans

N, K, X = map(int, input().split())
A = get_ints()
print(solve(N, K, X, A))