#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k, s, t, ans1, ans2;
  cin >> n;
  vector<int> d(n + 1), p(n + 1, 0);
  for (i = 1; i <= n; i++) {
    cin >> d[i];
    p[i] = p[i - 1] + d[i];
  }
  cin >> s >> t;
  if (s > t) swap(s, t);
  ans1 = p[t - 1] - p[s - 1];
  ans2 = p[s - 1] + p[n] - p[t - 1];
  cout << min(ans1, ans2) << "\n";
  return 0;
}
