/**
* author: Vi Gia Huy
* Vi Gia Huy will win APIO
**/
#include <bits/stdc++.h>
using namespace std;
const long long INF = (1ll<<60);
const int N = 2e3 + 4;
int n, a, b;
long long y[N];
namespace sub1 {
void sol() {
long long ans = INF;
for (int mask = 0; mask < (1 << n); mask++) {
long long total = 0;
long long sum = y[1];
int cnt = 1;
for (int i = 1; i < n; i++) {
if ((mask >> i) & 1) {
total = (total | sum);
sum = y[i + 1];
cnt++;
}
else {
sum += y[i + 1];
}
}
total = (total | sum);
if (a <= cnt && cnt <= b) ans = min(ans, total);
}
cout << ans;
return;
}
}
namespace sub2 {
bool dp[55][22][555];
int pre[N];
void sol() {
for (int i = 1; i <= n; i++) {
pre[i] = pre[i - 1] + y[i];
}
dp[0][0][0] = true;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= b; j++) {
for (int p = 0; p < i; p++) {
long long sum = pre[i] - pre[p];
for (int v = 0; v < 512; v++) {
if (dp[p][j - 1][v]) {
dp[i][j][(v | sum)] = true;
}
}
}
}
}
for (int v = 0; v < 512; v++) {
for (int i = a; i <= b; i++) {
if (dp[n][i][v]) {
cout << v;
return;
}
}
}
return;
}
}
namespace sub3 {
void sol() {
return;
}
}
namespace sub4 {
void sol() {
return;
}
}
namespace sub5 {
void sol() {
return;
}
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
bool checksub2 = true;
bool checksub3 = true;
cin >> n >> a >> b;
for (int i = 1; i <= n; i++) {
cin >> y[i];
if (y[i] > 10) checksub2 = false;
if (y[i] > 20) checksub3 = false;
}
if (1 <= n && n <= 20 && 1 <= a && a <= b && b <= n) sub1::sol();
else if (1 <= n && n <= 50 && 1 <= a && a <= b && b <= min(20, n) && checksub2) sub2::sol();
else if (1 <= n && n <= 100 && a == 1 && 1 <= b && n <= n && checksub3) sub3::sol();
else if (1 <= n && n <= 100 && 1 <= a && a <= b && b <= n) sub4::sol();
else if (1 <= n && n <= 2000 && a == 1 && 1 <= b && b <= n) sub5::sol();
return 0;
}