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 python
# 579D_or.py - Codeforces.com/problemset/problem/579/D by Sergey 2015

import unittest
import sys

###############################################################################
# Or Class (Main Program)
###############################################################################


class Or:
    """ Or representation """

    def __init__(self, test_inputs=None):
        """ Default constructor """

        it = iter(test_inputs.split("\n")) if test_inputs else None

        def uinput():
            return next(it) if it else sys.stdin.readline().rstrip()

        # Reading single elements
        [self.n, self.k, self.x] = map(int, uinput().split())

        # Reading a single line of multiple elements
        self.nums = list(map(int, uinput().split()))

        self.cnt = [0] * 100
        for n in self.nums:
            i = 0
            while n != 0:
                if n % 2:
                    self.cnt[i] += 1
                n >>= 1
                i += 1

        self.nmax = 0
        for n in self.nums:
            cur_cnt = list(self.cnt)
            i = 0
            nn = n
            while n != 0:
                if n % 2:
                    cur_cnt[i] -= 1
                n >>= 1
                i += 1
            n = nn * self.x ** self.k
            i = 0
            while n != 0:
                if n % 2:
                    cur_cnt[i] += 1
                n >>= 1
                i += 1

            k = 0
            for i in range(len(cur_cnt)):
                if cur_cnt[i] > 0:
                    k += 1 << i

            if k > self.nmax:
                self.nmax = k

    def calculate(self):
        """ Main calcualtion function of the class """

        result = self.nmax

        return str(result)

###############################################################################
# Unit Tests
###############################################################################


class unitTests(unittest.TestCase):

    def test_single_test(self):
        """ Or class testing """

        # Constructor test
        test = "3 1 2\n1 1 1"
        d = Or(test)
        self.assertEqual(d.n, 3)
        self.assertEqual(d.k, 1)
        self.assertEqual(d.x, 2)
        self.assertEqual(d.nums, [1, 1, 1])

        # Sample test
        self.assertEqual(Or(test).calculate(), "3")

        # Sample test
        test = "4 2 3\n1 2 4 8"
        self.assertEqual(Or(test).calculate(), "79")

        # Sample test
        test = ""
        # self.assertEqual(Or(test).calculate(), "0")

        # My tests
        test = ""
        # self.assertEqual(Or(test).calculate(), "0")

        # Time limit test
        # self.time_limit_test(5000)

    def time_limit_test(self, nmax):
        """ Timelimit testing """
        import random
        import timeit

        # Random inputs
        test = str(nmax) + " " + str(nmax) + "\n"
        numnums = [str(i) + " " + str(i+1) for i in range(nmax)]
        test += "\n".join(numnums) + "\n"
        nums = [random.randint(1, 10000) for i in range(nmax)]
        test += " ".join(map(str, nums)) + "\n"

        # Run the test
        start = timeit.default_timer()
        d = Or(test)
        calc = timeit.default_timer()
        d.calculate()
        stop = timeit.default_timer()
        print("\nTimelimit Test: " +
              "{0:.3f}s (init {1:.3f}s calc {2:.3f}s)".
              format(stop-start, calc-start, stop-calc))

if __name__ == "__main__":

    # Avoiding recursion limitaions
    sys.setrecursionlimit(100000)

    if sys.argv[-1] == "-ut":
        unittest.main(argv=[" "])

    # Print the result string
    sys.stdout.write(Or().calculate())
