#include <bits/stdc++.h>
using namespace std;
int main() {
  size_t n;
  cin >> n;
  size_t* arr = new size_t[n];
  for (size_t i = 0; i < n; i++) cin >> arr[i];
  size_t pos1, pos2;
  cin >> pos1 >> pos2;
  size_t sum1 = 0, sum2 = 0;
  size_t i = 0;
  for (i = pos1 - 1; i != pos2 - 1; i++) {
    if (i == n) {
      i = -1;
      continue;
    }
    sum1 += arr[i];
  }
  for (i = pos1 - 2; i != pos2 - 1; i--) {
    if (i == -1) {
      i = n;
      continue;
    }
    sum2 += arr[i];
  }
  sum2 += arr[pos2 - 1];
  cout << min(sum1, sum2);
  return 0;
}
