#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int f, e;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cin >> f >> e;
  f--;
  e--;
  int j = f, cnt1 = 0;
  while (j != e) {
    cnt1 += a[j];
    j++;
    if (j == n) {
      j = j % n;
    }
  }
  int cnt2 = 0;
  j = f;
  if (j == 0) {
    j = n - 1;
  } else
    j--;
  if (e == 0) {
    e = n - 1;
  } else
    e--;
  while (j != e) {
    cnt2 += a[j];
    if (j == 0) {
      j = n - 1;
    } else
      j--;
  }
  cout << min(cnt1, cnt2);
}
