#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,p, q;
int a[2005];
int pref[2005];
bool can(int mask){
int cnt = 0;
int last = 0;
for(int i = 1; i <= n; i++){
if(((pref[i] - pref[last]) & mask) == 0){
cnt++;
last = i;
}
}
return cnt >= p;
}
void solve(){
cin>>n>>p>>q;
for(int i = 1; i <= n; i++){
cin >> a[i];
pref[i] = pref[i-1] + a[i];
}
int ans = 0;
for(int b = 60; b >= 0; b--){
if(can(ans | (1LL << b)) == false){
ans |= (1LL << b);
}
}
cout << ans;
}
signed main()
{
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int T = 1;
//cin>>T;
while(T--){
solve();
}
return 0;
}