#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, s, d, sum1 = 0, sum2 = 0, total = 0, k;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    total += a[i];
  }
  cin >> s >> d;
  if (s > d) {
    k = d;
    d = s;
    s = k;
  }
  i = s - 1;
  while (i < d - 1) {
    sum1 = sum1 + a[i];
    i++;
  }
  sum2 = total - sum1;
  if (sum1 > sum2)
    cout << sum2;
  else
    cout << sum1;
  return 0;
}
