#include <bits/stdc++.h>
using namespace std;
int n, a[200], second, t;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  scanf("%d%d", &second, &t);
  int l = second, res = 0;
  while (l != t) {
    res += a[l];
    ++l;
    if (l > n) l -= n;
  }
  l = t;
  int cnt = 0;
  while (l != second) {
    cnt += a[l];
    ++l;
    if (l > n) l -= n;
  }
  res = min(res, cnt);
  cout << res;
  return 0;
}
