#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, strt, stop, res = 0;
  cin >> n;
  int dist[n], total;
  for (int i = 0; i < n; i++) {
    cin >> dist[i];
    total += dist[i];
  }
  cin >> strt >> stop;
  if (strt > stop) swap(strt, stop);
  for (int i = strt; i < stop; ++i) {
    res += dist[i - 1];
  }
  cout << min(res, total - res);
  return 0;
}
