#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
long long c[N << 2], a[N];
void pushup(int rt) { c[rt] = c[rt << 1] | c[rt << 1 | 1]; }
void build(int rt, int l, int r) {
  if (l == r) {
    scanf("%I64d", c + rt);
    a[l] = c[rt];
    return;
  }
  int mid = (l + r) >> 1;
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
  pushup(rt);
}
long long query(int rt, int l, int r, int x, int y) {
  if (x > y) return 0;
  if (x <= l && r <= y) {
    return c[rt];
  }
  int mid = (l + r) >> 1;
  long long ret = 0;
  if (x <= mid) ret |= query(rt << 1, l, mid, x, y);
  if (mid < y) ret |= query(rt << 1 | 1, mid + 1, r, x, y);
  return ret;
}
int main() {
  int n, k, c;
  while (~scanf("%d%d%d", &n, &c, &k)) {
    long long tmp = 1;
    for (int i = 1; i <= c; i++) {
      tmp *= k;
    }
    build(1, 1, n);
    long long ans = (tmp * a[1]) | query(1, 1, n, 2, n);
    ans = max(ans, (tmp * a[n]) | query(1, 1, n, 1, n - 1));
    for (int i = 2; i < n; i++) {
      ans = max(ans, query(1, 1, n, 1, i - 1) | (tmp * a[i]) |
                         query(1, 1, n, i + 1, n));
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
