#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l = 0, l1 = 0;
  cin >> n;
  vector<int> v;
  int m[n * 2];
  for (int i = 0; i < n; i++) {
    cin >> m[i];
  }
  for (int i = 0; i < n; i++) {
    v.push_back(m[i]);
  }
  for (int i = 0; i < n; i++) {
    v.push_back(m[i]);
  }
  int s, t;
  cin >> s >> t;
  if (s == t) {
    cout << 0 << endl;
    return 0;
  }
  if (s > t) {
    swap(s, t);
  }
  for (int i = s - 1; i < t - 1; i++) {
    l = l + v[i];
  }
  s = s + n;
  for (int i = t - 1; i < s - 1; i++) {
    l1 = l1 + v[i];
  }
  cout << min(l1, l) << endl;
  return 0;
}
