#include<bits/stdc++.h> #define MAX_N 2000 usingnamespace std; typedeflonglong lnt; template <classT> inlinevoidread(T &x){ x = 0; int c = getchar(), f = 1; for (; !isdigit(c); c = getchar()) if (c == 45) f = -1; for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0'); } int n, m, A, B; lnt s[MAX_N+5], ans; bool f[MAX_N+5][MAX_N+5]; int g[MAX_N+5]; voidsub1(){ for (int p = m, flag = 1; p; p--, flag = 1) { memset(f, false, sizeof f), f[0][0] = true; for (int i = 1; i <= n; i++) for (int j = 1; j <= i; j++) for (int k = j-1; k < i; k++) if (f[k][j-1]) { if ((((s[i]-s[k])>>p)|ans)^ans) continue; if ((s[i]-s[k])&(1LL<<(p-1))) continue; f[i][j] = true; break; } for (int i = A; i <= B; i++) if (f[n][i]) {flag = 0; break;} (ans <<= 1) |= flag; } printf("%lld\n", ans); } voidsub2(){ for (int p = m; p; p--) { memset(g, 0x3f, sizeof g), g[0] = 0; for (int i = 1; i <= n; i++) for (int k = 0; k < i; k++) { if ((((s[i]-s[k])>>p)|ans)^ans) continue; if ((s[i]-s[k])&(1LL<<(p-1))) continue; g[i] = min(g[i], g[k]+1); } (ans <<= 1) |= (g[n] > B); } printf("%lld\n", ans); } intmain(){ read(n), read(A), read(B); for (int i = 1; i <= n; i++) read(s[i]), s[i] += s[i-1]; for (lnt i = s[n]; i; i >>= 1) m++; return (A != 1 ? sub1() : sub2()), 0; }