#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e2 + 5;
const int INF = 1e18;
int a[N], dp[N][N];
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, l, r;
cin >> n >> l >> r;
for(int i = 1; i <= n; i++)
cin >> a[i];
if(n <= 20){
int mn = INF;
vector < int > v;
for(int i = 1; i <= n; i++)
v.push_back(a[i]);
for(int bit = 0; bit < (1 << n); bit++){
map < int , bool > is;
int tot = 0, cnt = 1, cur = v[0];
for(int i = 0; i < n - 1; i++){
if(bit & (1 << i)){
tot = (tot | cur);
cur = v[i + 1];
cnt++;
}
else {
cur += v[i + 1];
}
}
tot = (tot | cur);
if(cnt >= l && cnt <= r)mn = min(mn, tot);
}
cout << mn << "\n";
}
}
/*
6 1 3
8 1 2 1 5 4
*/