#include <bits/stdc++.h>
using namespace std;
int i, j, n, k, y, q;
long long arb[800005], a[200005], aux, rs, gmb, x;
void update(int left, int right, int nod) {
  if (left == right)
    arb[nod] = y;
  else {
    int pivot = (left + right) / 2;
    if (x <= pivot)
      update(left, pivot, 2 * nod);
    else
      update(pivot + 1, right, 2 * nod + 1);
    arb[nod] = arb[2 * nod] | arb[2 * nod + 1];
  }
}
void query(int left, int right, int nod) {
  if (left >= x && right <= y)
    aux |= arb[nod];
  else {
    int pivot = (left + right) / 2;
    if (x <= pivot) query(left, pivot, 2 * nod);
    if (y > pivot) query(pivot + 1, right, 2 * nod + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k >> q;
  for (i = 1; i <= n; ++i) cin >> a[i], y = a[i], x = i, update(1, n, 1);
  for (rs = arb[1], i = 1; i <= n; ++i) {
    aux = 0;
    x = 1;
    y = i - 1;
    if (x <= y) query(1, n, 1);
    x = i + 1;
    y = n;
    if (x <= y) query(1, n, 1);
    for (gmb = a[i] * q, j = 1; j <= k; ++j) rs = max(rs, aux | gmb), gmb *= q;
  }
  cout << rs << '\n';
  return 0;
}
