#include <stdio.h>
#define ll long long
#define min(a,b) a<b?a:b
int main() {
    ll n;
    if (scanf("%lld", &n) != EOF) {
        ll a[n], dp[n];
        ll sum = 0;
        for(ll i = 0; i < n; i++) {
            if(scanf("%lld", &a[i]) != EOF) {
                sum += a[i];
                // printf("a[%d]: %d\n", i, a[i]);
                // printf("dp[%d]: %d\n", i, dp[i]);
            } else printf("error2\n");
        }
        dp[0] = a[0];
        for(ll i = 1; i < n; i++) {
            dp[i] = dp[i - 1] + a[i];
        }
        ll x, y;
        if(scanf("%lld %lld", &x, &y) != EOF) {
            ll clockwise = dp[y - 2] - dp[x - 2];
            // printf("clockwise: %lld\n", clockwise);
            if(clockwise < 0) clockwise = -clockwise;
            ll counterclockwise = sum - clockwise;
            // printf("counterclockwise:%lld\n", counterclockwise);
            if(counterclockwise < 0) counterclockwise = -counterclockwise;
            
            printf("%lld\n", min(clockwise, counterclockwise));
        } else printf("error3\n");
    } else printf("error1\n");
    return 0;
}