#include <bits/stdc++.h>
using namespace std;
int main() {
  int* d = new int[105];
  int n, tot = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> d[i];
    tot += d[i];
  }
  int s, t;
  cin >> s >> t;
  if (s > t) {
    swap(s, t);
  }
  int ans = 0;
  for (int i = s; i < t; ++i) {
    ans += d[i];
  }
  cout << min(ans, tot - ans);
  return 0;
}
