#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, ans1 = 0, ans2 = 0;
  cin >> n;
  vector<int> c(n);
  for (int i = 0; i < n; i++) cin >> c[i];
  cin >> a >> b;
  if (a > b) swap(a, b);
  a--;
  b--;
  for (int i = a; i < b; i++) {
    ans1 += c[i];
  }
  for (int i = 0; i < a; i++) {
    ans2 += c[i];
  }
  for (int i = b; i < n; i++) {
    ans2 += c[i];
  }
  cout << min(ans1, ans2);
  return 0;
}
