#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#define fo(i,a,b) for(int i=a;i<=b;++i)
#define fod(i,a,b) for(int i=a;i>=b;--i)
#define N 2005
#define M 105
#define LL long long
using namespace std;
int n,a[N],L,R,g[N];
LL cf[41];
bool f[M][M];
int main()
{
cin>>n>>L>>R;
cf[0]=1;
fo(i,1,40) cf[i]=cf[i-1]<<1;
fo(i,1,n) scanf("%d",&a[i]);
if(n<=100)
{
LL s1=0;
fod(t,40,0)
{
bool pd=0;
memset(f,0,sizeof(f));
f[0][0]=1;
fo(i,1,n)
{
fo(k,1,i)
{
LL v=0;
fod(j,i,1)
{
v+=a[j];
if((((v>>t)<<t)|s1)!=s1) continue;
f[i][k]|=f[j-1][k-1];
if(f[i][k]) break;
}
if(i==n&&L<=k&&k<=R&&f[i][k]) {pd=1;break;}
}
}
if(!pd) s1^=cf[t];
}
printf("%lld\n",s1);
}
else
{
LL s1=0;
fod(t,40,0)
{
bool pd=0;
memset(g,107,sizeof(g));
g[0]=0;
fo(i,1,n)
{
LL v=0;
fod(j,i,1)
{
v+=a[j];
if((((v>>t)<<t)|s1)!=s1) continue;
g[i]=min(g[i],g[j-1]+1);
}
if(g[n]<=R) {pd=1;break;}
}
if(!pd) s1^=cf[t];
}
printf("%lld\n",s1);
}
}