#include <bits/stdc++.h>
using namespace std;
int N, dist, distSum, stat1, stat2, i, j, k;
int main() {
  vector<int> myVector;
  cin >> N;
  for (i = N; i > 0; i--) {
    cin >> dist;
    myVector.push_back(dist);
    distSum += dist;
  }
  cin >> stat1 >> stat2;
  if (stat1 > stat2) {
    j = stat2;
    stat2 = stat1;
    stat1 = j;
  }
  for (i = stat1 - 1; i < stat2 - 1; i++) k += myVector[i];
  if ((distSum - k) > k)
    cout << k << endl;
  else
    cout << distSum - k << endl;
  return 0;
}
