#include <bits/stdc++.h>
using namespace std;
bool dbg = 0;
long long N, K, P;
vector<vector<long long> > inp;
long long dp[200005][15];
long long Solve1(int pos, int Left) {
  if (pos == N) {
    return (long long)0;
  } else {
    if (dp[pos][Left] != (long long)-1) {
      return dp[pos][Left];
    }
    long long Ans = 0;
    for (int n = 0; n <= Left; ++n) {
      Ans = max(Ans, inp[pos][n] | Solve1(pos + 1, Left - n));
    }
    return (dp[pos][Left] = Ans);
  }
}
long long Solve2(int pos, int Left) {
  if (pos < 0) {
    return (long long)0;
  } else {
    if (dp[pos][Left] != (long long)-1) {
      return dp[pos][Left];
    }
    long long Ans = 0;
    for (int n = 0; n <= Left; ++n) {
      Ans = max(Ans, inp[pos][n] | Solve2(pos - 1, Left - n));
    }
    return (dp[pos][Left] = Ans);
  }
}
int main() {
  cin >> N >> K >> P;
  inp.resize(N + 5);
  long long x;
  memset(dp, (long long)-1, sizeof(dp));
  ;
  for (int n = 0; n < N; ++n) {
    scanf("%lld", &x);
    long long temp;
    temp = x;
    for (int q = 0; q <= 12; ++q) {
      inp[n].push_back(temp);
      temp *= P;
    }
  }
  if (dbg) {
    for (int n = 0; n < N; ++n) {
      for (int m = 0; m <= K; ++m) {
        cout << inp[n][m] << " ";
      }
      cout << endl;
    }
  }
  long long Ans = Solve1(0, K);
  memset(dp, (long long)-1, sizeof(dp));
  ;
  Ans = max(Ans, Solve2(N - 1, K));
  cout << Ans << endl;
  return 0;
}
