#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
long long len[200001];
long long qian[200001], hou[200001];
long long mix = 1;
long long maxx = 0;
void init() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &len[i]);
  for (int i = 1; i <= m; i++) mix *= k;
  for (int i = 1; i <= n; i++) qian[i] = qian[i - 1] | len[i];
  for (int i = n; i >= 1; i--) hou[i] = hou[i + 1] | len[i];
  for (int i = 1; i <= n; i++)
    maxx = max(maxx, qian[i - 1] | (len[i] * mix) | hou[i + 1]);
  cout << maxx << endl;
}
int main() {
  init();
  return 0;
}
