//####################
//BaliSculture
//####################
#include<bits/stdc++.h>
#define rall(x) x.rbegin(), x.rend()
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
const int LOG = 30;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n,a,b;
cin>>n>>a>>b;
vector<int> vals(n);
for(int &i:vals)cin>>i;
int mask = 0;
for(int b=0;b<LOG ; b++)mask|=(1<<b);
auto possible = [&](int acceptable){
vector<vector<bool>> dp(n+1,vector<bool>(n+1,false));
for(int k = 0 ; k <= n ; k++)dp[n][k] = true;
for(int k=1 ; k <= n ; k++){
for(int pos = n-1 ; pos>=0 ; pos--){
int sum(0);
for(int i = pos ; i < n ; i++){
sum += vals[i];
if((sum|acceptable) == acceptable){//on est bon
dp[pos][k] = dp[i+1][k-1];
if(dp[pos][k])break;
}
}
}
}
for(int g=a; g<=b ; g++)if(dp[0][g])return true;
return false;
};
for(int b = LOG-1 ; b>=0 ; b--){
if(possible(mask^(1<<b))){
mask = (mask^(1<<b));
}
}
cout << mask << endl;
return 0;
};