#include <bits/stdc++.h>
char _;
using namespace std;
const int MAXN = 200005;
int N, K, X, A[MAXN];
long long ans;
long long a[MAXN], b[MAXN];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> K >> X;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  for (int i = 1; i <= N; i++) {
    a[i] = a[i - 1] | A[i];
  }
  for (int i = N; i >= 1; i--) {
    b[i] = b[i + 1] | A[i];
  }
  for (int i = 1; i <= N; i++) {
    long long temp = A[i];
    for (int j = 1; j <= K + 1; j++) {
      ans = max(ans, (a[i - 1] | temp) | b[i + 1]);
      temp *= X;
    }
  }
  cout << ans << endl;
}
