#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
template <class T>
inline void gmax(T &a, T &b) {
  if (b > a) a = b;
}
template <class T>
inline void gmin(T &a, T &b) {
  if (b < a) a = b;
}
using namespace std;
const int N = 2e5 + 100;
const double PI = acos(-1.0);
void fre() {
  freopen("/Users/luras/Desktop/in.txt", "r", stdin);
  freopen("/Users/luras/Desktop/out.txt", "w", stdout);
}
const int INF = 16843009;
int casenum, casei;
struct A {
  long long v, num;
} a[N];
int cmp(A a, A b) {
  if (a.num == b.num) return a.v > b.v;
  return a.num > b.num;
}
long long n, k, x, sum, res, ans, t, xx, y, b[N], c[N];
int main() {
  c[1] = 1;
  for (int i = 2; i <= 63; i++) c[i] = c[i - 1] * 2;
  while (~scanf("%I64d%I64d%I64d", &n, &k, &xx)) {
    sum = 0;
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    for (int i = 1; i <= n; i++) {
      scanf("%I64d", &a[i].v);
      x = a[i].v;
      t = 1;
      while (x) {
        if (x & 1) b[t]++;
        a[i].num++;
        x >>= 1;
        t++;
      }
      sum |= a[i].v;
    }
    ans = sum;
    res = sum;
    sort(a + 1, a + n + 1, cmp);
    x = a[1].num;
    for (int i = 1; i <= n; i++) {
      sum = res;
      y = a[i].v;
      t = 1;
      while (y) {
        if ((y & 1) && b[t] == 1) sum -= c[t];
        t++;
        y >>= 1;
      }
      y = a[i].v;
      for (int j = 1; j <= k; j++) {
        y *= xx;
      }
      sum |= y;
      gmax(ans, sum);
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
