#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, k, c;
  cin >> a >> k >> c;
  long long b = 1;
  while (k--) b *= c;
  vector<long long> v(a + 2), l(a + 2), r(a + 2);
  for (int i = 1; i <= a; i++) {
    cin >> v[i];
  }
  for (int i = 1; i <= a; i++) {
    l[i] = v[i] | l[i - 1];
    r[a - i + 1] = v[a - i + 1] | r[a - i + 2];
  }
  long long ans = 0;
  for (int i = 1; i <= a; i++) {
    ans = max(ans, l[i - 1] | (v[i] * b) | r[i + 1]);
  }
  if (ans == 74) {
    for (int i = 1; i <= a; i++) cout << l[i] << ' ';
    for (int i = 1; i <= a; i++) cout << r[i] << ' ';
    for (int i = 1; i <= a; i++) cout << v[i] << ' ';
    for (int i = 1; i <= a; i++)
      cout << (l[i - 1] | v[i] * b | r[i + 1]) << endl;
  }
  cout << ans << endl;
}
