#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9);
const int N = 2009;
const int LOG = 60;
int n, A, B;
int a[N];
int64_t sum[N];
bool check(int64_t mask) {
vector<int> dp(n + 1, inf);
dp[0] = 0;
for (int i = 1; i <= n; i++) {
for (int j = 0; j < i; j++) {
auto s = sum[i] - sum[j];
if ((s | mask) == mask) {
dp[i] = min(dp[i], dp[j] + 1);
}
}
}
return (dp[n] <= B);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> A >> B;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= n; i++) {
sum[i] = sum[i - 1] + a[i];
}
int64_t ans = (int64_t(1) << LOG) - 1;
for (int j = LOG - 1; j >= 0; j--) {
if (check(ans ^ (int64_t(1) << j))) {
ans ^= int64_t(1) << j;
}
}
cout << ans << '\n';
return 0;
}