#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <bitset>
#include <map>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;
const bool debug = true;
#define ff first
#define ss second
#define all(X) (X).begin(), (X).end()
#define rall(X) (X).rbegin(), (X).rend()
const int N = 2e3 + 5;
const int mod = 1e9 + 7;
const ll LOG = 60;
long long x[N];
int dp[N];
void solve()
{
int n, a, b;
cin >> n >> a >> b;
for (int i = 1; i <= n; i++)
cin >> x[i];
ll ans = (1ll << (LOG + 1)) - 1ll;
ll cur = 0;
for (int bt = LOG; bt >= 0; bt--)
{
for (int i = 1; i <= n; i++)
{
dp[i] = 1e9;
}
dp[0] = 0;
ll h = (1ll << (LOG + 1)) - (1ll << (bt));
for (int i = 1; i <= n; i++)
{
ll s = 0;
for (int j = i; j >= 1; j--)
{
s += x[j];
if ((h & s) == cur)
dp[i] = min(dp[i], dp[j - 1] + 1);
}
}
if(dp[n] <= b)
{
ans -= (1ll << bt);
}
else
{
cur += (1ll << bt);
}
}
cout << ans << endl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int t = 1;
//cin >> t;
while (t--)
{
solve();
}
return 0;
}