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.
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int x, long long int y) {
  return y == 0 ? x : gcd(y, x % y);
}
long long int power(long long int x, long long int y) {
  long long int temp = 1;
  while (y > 0) {
    if (y & 1) temp = (temp * x);
    x *= x;
    y /= 2;
  }
  return temp;
}
bool isPalin(string x) {
  long long int len = x.length();
  for (int i = 0; i <= (len / 2) - 1; ++i) {
    if (x[i] != x[len - 1 - i]) return false;
  }
  return true;
}
string tolowerStr(string x) {
  string ret = "";
  for (int i = 0; i <= (long long int)x.length() - 1; ++i) {
    ret.push_back(tolower(x[i]));
  }
  return ret;
}
string toupperStr(string x) {
  string ret = "";
  for (int i = 0; i <= (long long int)x.length() - 1; ++i) {
    ret.push_back(toupper(x[i]));
  }
  return ret;
}
long long int modulo(long long int a, long long int b, long long int c) {
  long long int x = 1;
  long long int y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y) % c;
    }
    y = (y * y) % c;
    b /= 2;
  }
  return x % c;
}
long long int mulmod(long long int a, long long int b, long long int c) {
  long long int x = 0;
  long long int y = a % c;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x + y) % c;
    }
    y = (y * 2) % c;
    b /= 2;
  }
  return x % c;
}
long long int DigitSum(long long int n) {
  long long int temp = 0;
  n = ((n) < 0 ? -(n) : (n));
  while (n) {
    temp += (n % 10);
    n /= 10;
  }
  return temp;
}
bool double_equals(double a, double b, double epsilon = 0.1) {
  return std::abs(a - b) < epsilon;
}
bool comp(pair<long long int, long long int> a,
          pair<long long int, long long int> b) {
  if (a.first < b.first)
    return true;
  else if (a.first > b.first)
    return false;
  else {
    if (a.second > b.second)
      return true;
    else
      return false;
  }
}
long long int ar[200005];
long long int fwd[200005];
long long int bck[200005];
int main() {
  ios_base::sync_with_stdio(false);
  long long int n, k, x, p, maxi;
  cin >> n >> k >> x;
  for (int i = 1; i <= n; ++i) cin >> ar[i];
  p = power(x, k);
  fwd[1] = ar[1];
  for (int i = 2; i <= n; ++i) fwd[i] = fwd[i - 1] | ar[i];
  bck[n] = ar[n];
  for (int i = n - 1; i >= 1; --i) bck[i] = bck[i + 1] | ar[i];
  maxi = -1;
  for (int i = 1; i <= n; ++i)
    maxi = ((maxi) > ((fwd[i - 1] | (ar[i] * p) | bck[i + 1]))
                ? (maxi)
                : ((fwd[i - 1] | (ar[i] * p) | bck[i + 1])));
  cout << maxi << endl;
  return 0;
}
