#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, a[105], c = 0, f = 0, r, p, s, t, j;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    c += a[i];
  }
  cin >> s >> t;
  if (s > t) {
    p = s;
    s = t;
    t = p;
  }
  for (j = s; j < t; j++) {
    f += a[j];
  }
  r = c - f;
  if (f <= r)
    cout << f;
  else
    cout << r;
}
