#include <bits/stdc++.h>
using namespace std;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> input) {
  os << "(" << input.first << ", " << input.second << ")";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> input) {
  for (auto t : input) os << t << " ";
  return os;
}
int a[200003];
long long dp[11][200003];
long long p[12][12];
int n;
long long solve(int in, int k, long long x) {
  if (in == n + 1) return 0;
  if (dp[k][in] != -1) return dp[k][in];
  if (k == 0)
    return dp[k][in] = a[in] | solve(in + 1, k, x);
  else {
    long long mx = a[in] | solve(in + 1, k, x);
    for (int i = 0; i <= k; i++) {
      long long ians = (a[in] * p[x][i]) | solve(in + 1, k - i, x);
      if (ians > mx) mx = ians;
    }
    return dp[k][in] = mx;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof dp);
  int k;
  long long x;
  cin >> n >> k >> x;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1, greater<int>());
  for (int i = 0; i <= 11; i++) {
    for (int j = 0; j <= 11; j++) {
      if (j == 0)
        p[i][j] = 1;
      else
        p[i][j] = p[i][j - 1] * i;
    }
  }
  long long ans = solve(1, k, x);
  memset(dp, -1, sizeof dp);
  sort(a + 1, a + n + 1);
  ans = max(ans, solve(1, k, x));
  cout << ans << "\n";
  return 0;
}
