#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2000+5;
int a[N];
vector<int> dp[N];
// for(int i=1; i<=n; i++)
void solve(){
int n, L, R; cin >> n >> L >> R;
for(int i=1; i<=n; i++) cin >> a[i];
int cur = 0;
for(int b=60; b>=0; b--){
for(int i=0; i<=n; i++) dp[i].assign(R+1, 0);
dp[0][0] = 1;
cur += (1ll<<b)-1;
for(int i=1; i<=n; i++){
for(int g=1; g<=R; g++){
// if(b == 3) cout << i << " " << g << ": ";
int sm = 0;
for(int j=i; j>=1; j--){
sm += a[j];
if((sm|cur) != cur) continue;
dp[i][g] |= dp[j-1][g-1];
// if(b == 3) cout << j << " " << dp[i][g] << '\n';
}
// if(b == 3) cout << endl;
}
// if(b == 3) cout << endl;
// if(b == 3) cout << endl;
}
cur -= (1ll<<b)-1;
bool has = false;
for(int g=L; g<=R; g++){
if(dp[n][g]) has = true;
}
if(!has) cur += (1ll<<b);
}
cout << cur;
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
solve();
}