#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, s, t, a[1000];
  while (scanf("%d", &n) != EOF) {
    int ans = 0;
    for (i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      ans += a[i];
    }
    scanf("%d%d", &s, &t);
    if (s > t) {
      int tmp = s;
      s = t;
      t = tmp;
    }
    int ans1 = 0;
    for (i = s; i < t; i++) ans1 += a[i];
    cout << min(ans1, ans - ans1) << endl;
  }
  return 0;
}
