#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, s1, s2, s = 0, c = 0;
  cin >> n;
  vector<int> v(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    s += v[i];
  }
  cin >> s1 >> s2;
  if (s1 > s2) swap(s1, s2);
  for (int i = s1; i < s2; i++) {
    c += v[i];
  }
  cout << min(c, (s - c)) << endl;
  return 0;
}
