#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) cin >> d[i];
  int s, t;
  cin >> s >> t;
  s--;
  t--;
  int res1 = 0, res2 = 0;
  for (int i = s; i != t; i = (i + 1 < n) ? (i + 1) : 0) {
    res1 += d[i];
  }
  for (int i = s; i != t; i = (i - 1 < 0) ? (n - 1) : (i - 1)) {
    if (i - 1 >= 0)
      res2 += d[i - 1];
    else
      res2 += d[n - 1];
  }
  cout << min(res1, res2) << endl;
  return 0;
}
