#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int d[n];
  for (int i = 0; i < n; i++) cin >> d[i];
  int s, t;
  cin >> s >> t;
  s--;
  t--;
  int tmp = s;
  s = min(s, t);
  t = max(tmp, t);
  if (s == t)
    printf("0\n");
  else {
    int way = 0;
    for (int i = s; i < t; i++) way += d[i];
    int way1 = 0;
    for (int i = t; i < n; i++) way1 += d[i];
    for (int i = 0; i < s; i++) way1 += d[i];
    printf("%d\n", min(way, way1));
  }
  return 0;
}
