#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using ld = long double; #define all(v) v.begin(), v.end() #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep2(i, n, m) for (ll i = n; i <= m; ++i) #define rep3(i, n, m) for (ll i = n; i >= m; --i) template using pqg = priority_queue, greater>; template using pq = priority_queue; template inline bool chmax(S &a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(S &a, T b) { if (a > b) { a = b; return true; } return false; } int main() { int n, s, t; cin >> n >> s >> t; --s, --t; vector sum(2*n+1, 0); rep(i, n) { int a; cin >> a; sum[i+1] = sum[n+i+1] = a; } rep(i, 2*n) sum[i+1] += sum[i]; ll tot = sum[n]; // rep(i, 2 * n + 1) cout << sum[i] << endl; int p1 = (n + 1) / 2, p2 = n - p1; ll ans = -1e18; rep(i, p1) { int l = s + (n - i), r = (l + p1); if ((l <= t && t < r) || (l <= t + n && t + n < r)) continue; ll p1sum = sum[r] - sum[l], p2sum = tot - p1sum; chmax(ans, p1sum - p2sum); } cout << ans << endl; return 0; }