#include <bits/stdc++.h>
using namespace std;
unsigned long long mas1[101];
unsigned long long mas2[500000];
void up(int indx) {
  string s = bitset<100>(mas2[indx]).to_string();
  for (int i = 0; i < 100; i++) {
    mas1[i] += ((int)s[i] - '0');
  }
}
void down(int indx) {
  string s = bitset<100>(mas2[indx]).to_string();
  for (int i = 0; i < 100; i++) {
    mas1[i] -= ((int)s[i] - '0');
  }
}
int main() {
  unsigned long long n, k, x;
  cin >> n >> k >> x;
  for (int i = 0; i < n; i++) {
    cin >> mas2[i];
    up(i);
  }
  unsigned long long t = pow(x, k);
  unsigned long long ans = 0;
  for (int i = 0; i < n; i++) {
    down(i);
    string s = bitset<100>((unsigned long long)(mas2[i] * t)).to_string();
    for (int j = 0; j < 100; j++) {
      if (s[j] == '0' && mas1[j] > 0) {
        s[j] = '1';
      }
    }
    up(i);
    ans = max(ans, bitset<100>(s).to_ullong());
  }
  cout << ans << endl;
}
