#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000 + 10;
int cnt[80], n, k, x;
long long a[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> x;
  for (int i = 0; i < n; ++i) {
    long long t;
    cin >> t;
    a[i] = t;
    for (int j = 0; t; ++j)
      if (t & (1ull << j)) {
        ++cnt[j];
        t -= (1ull << j);
      }
  }
  long long ans = 0, pw = 1;
  for (int i = 0; i < k; ++i) pw *= x;
  for (int i = 0; i < n; ++i) {
    long long m = a[i], n = a[i] * pw;
    for (int k = 0; m; ++k) {
      if (m & (1ull << k)) {
        --cnt[k];
        m -= (1ull << k);
      }
    }
    for (int k = 0; n; ++k) {
      if (n & (1ull << k)) {
        ++cnt[k];
        n -= (1ull << k);
      }
    }
    long long now = 0;
    for (int j = 0; j < 70; ++j)
      if (cnt[j]) {
        now |= ((1ull) << j);
      }
    if (now > ans) ans = now;
    m = a[i], n = a[i] * pw;
    for (int k = 0; m; ++k) {
      if (m & (1ull << k)) {
        ++cnt[k];
        m -= (1ull << k);
      }
    }
    for (int k = 0; n; ++k) {
      if (n & (1ull << k)) {
        --cnt[k];
        n -= (1ull << k);
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
