#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum;
  cin >> n;
  sum = 0;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  int l, r;
  cin >> l >> r;
  int x, y;
  x = 0;
  y = min(l, r);
  r = max(l, r);
  l = y;
  for (int i = l - 1; i < r - 1; i++) {
    x += arr[i];
  }
  cout << min(x, sum - x) << endl;
}
