#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, c = 0, s, t, b = 0, d, p, q, k, j;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  cin >> s >> t;
  p = min(s, t);
  q = max(s, t);
  for (i = p - 1; i < q - 1; i++) {
    b += a[i];
  }
  for (j = q - 1; j < n; j++) {
    c += a[j];
  }
  for (k = 0; k < p - 1; k++) {
    c += a[k];
  }
  d = min(b, c);
  cout << d << endl;
  return 0;
}
