#include <bits/stdc++.h>
using namespace std;
int main() {
  int num, i, a[105];
  int s, t, sum = 0, sums = 0;
  cin >> num;
  for (i = 1; i <= num; i++) {
    cin >> a[i];
    sums = sums + a[i];
  }
  int tem;
  cin >> s >> t;
  {
    if (s >= t) {
      tem = s;
      s = t;
      t = tem;
    }
  }
  for (i = s; i < t; i++) {
    sum = sum + a[i];
  }
  if (sum <= sums - sum)
    cout << sum << endl;
  else
    cout << sums - sum << endl;
  return 0;
}
