#include <bits/stdc++.h>
using namespace std;
long long A[200005];
int B[200005];
long long mx, ans;
int Left[200005], Right[200005];
int main() {
  int n, m, i, j, k, q = 1;
  cin >> n >> m >> k;
  for (i = 1; i <= n; i++) {
    cin >> A[i];
  }
  for (i = 1; i <= m; i++) {
    q *= k;
  }
  sort(A + 1, A + n + 1);
  for (i = 1; i <= n; i++) {
    Left[i] = Left[i - 1] | A[i];
  }
  for (i = n; i >= 1; i--) {
    Right[i] = Right[i + 1] | A[i];
  }
  for (i = 1; i <= n; i++) {
    ans = 1LL * A[i] * q | Left[i - 1] | Right[i + 1];
    mx = max(mx, ans);
  }
  cout << mx;
  return 0;
}
