#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1000001;
long long n, m, e, a[maxn], sum1[maxn], sum2[maxn];
long long ans = 1, sum;
signed main() {
  cin >> n >> m >> e;
  for (long long i = 1; i <= m; i++) ans = ans * e;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i < n; i++) sum1[i + 1] = sum1[i] | a[i];
  for (long long i = n; i > 1; i--) sum2[i - 1] = sum2[i] | a[i];
  for (long long i = 1; i <= n; i++)
    sum = max(sum1[i] | (a[i] * ans) | sum2[i], sum);
  printf("%lld", sum);
  return 0;
}
