#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 9;
long long a[maxn];
long long pre[maxn];
long long suf[maxn];
int main() {
  std::ios::sync_with_stdio(0);
  long long i, j, k, t, q, m, l, r, n;
  cin >> n >> k >> m;
  long long ans = 0;
  long long temp = 1;
  for (long long i = 0; i < k; i++) temp *= m;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    ans |= a[i];
  }
  pre[0] = a[0];
  suf[n - 1] = a[n - 1];
  for (i = 1; i < n; i++) {
    pre[i] = a[i] | pre[i - 1];
  }
  for (i = n - 2; i >= 0; i--) {
    suf[i] = a[i] | suf[i + 1];
  }
  ans = ((ans) > ((a[0] * temp) | suf[1]) ? (ans) : ((a[0] * temp) | suf[1]));
  ans = ((ans) > ((a[n - 1] * temp) | pre[n - 2])
             ? (ans)
             : ((a[n - 1] * temp) | pre[n - 2]));
  for (long long i = 1; i <= n - 2; i++)
    ans = ((ans) > (pre[i - 1] | (a[i] * temp) | suf[i + 1])
               ? (ans)
               : (pre[i - 1] | (a[i] * temp) | suf[i + 1]));
  cout << ans << '\n';
}
