#include <bits/stdc++.h>
#pragma comment(linker, "/stack:67108864")
using namespace std;
const long double EPS = 1e-9;
const long double PI = 3.1415926535897932384626433832795;
const long long INF = 1000 * 1000 * 1000 + 9;
const int NMAX = 1000 * 1000 + 3;
int n, k;
long long x;
long long a[NMAX];
inline bool read() {
  if (!(cin >> n >> k >> x)) return false;
  for (int i = 0; i < int(n); ++i) {
    int cnt;
    scanf("%d", &cnt);
    a[i] = cnt;
  }
  return true;
}
inline void solve() {
  sort(a, a + n);
  reverse(a, a + n);
  int bit = 0;
  for (int i = 0; i < int(32); ++i) {
    if ((a[0] >> i) & 1) bit = i;
  }
  long long xr = 1;
  for (int i = 0; i < int(k); ++i) xr *= x;
  x = xr;
  long long s[64], ans = 0;
  memset(s, 0, sizeof s);
  for (int i = 0; i < int(n); ++i)
    for (int j = 0; j < int(64); ++j) s[j] += ((a[i] >> j) & 1);
  for (int j = 0; j < int(64); ++j) ans += ((s[j] > 0) << j);
  for (int i = 0; i < int(n); ++i) {
    if (!true) break;
    for (int j = 0; j < int(64); ++j) s[j] -= ((a[i] >> j) & 1);
    a[i] *= x;
    for (int j = 0; j < int(64); ++j) s[j] += ((a[i] >> j) & 1);
    long long cur = 0;
    for (int j = 0; j < int(64); ++j) cur += ((1LL * (s[j] > 0)) << j);
    ans = max(ans, cur);
    for (int j = 0; j < int(64); ++j) s[j] -= ((a[i] >> j) & 1);
    a[i] /= x;
    for (int j = 0; j < int(64); ++j) s[j] += ((a[i] >> j) & 1);
  }
  cout << ans << endl;
}
int main() {
  ifstream ifile("input.txt");
  if (ifile) {
    freopen("input.txt", "rt", stdin);
  }
  if (ifile) {
    freopen("output.txt", "wt", stdout);
  }
  while (read()) solve();
  return 0;
}
