#include <bits/stdc++.h>
using namespace std;
int n;
int d[110];
int s;
int main() {
  while (scanf("%d", &n) != EOF) {
    s = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &d[i]);
      s += d[i];
    }
    int st, ed;
    scanf("%d %d", &st, &ed);
    int a = min(st, ed), b = max(st, ed);
    int ans = 0;
    for (int i = a; i < b; i++) ans += d[i];
    ans = min(ans, s - ans);
    printf("%d\n", ans);
  }
  return 0;
}
