#include <bits/stdc++.h>
using namespace std;
long long n, i, c, b, s, q, s1, w, mn = 0, d;
int main() {
  cin >> n;
  long long a[n];
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<long long> v;
  cin >> b >> c;
  v.push_back(b);
  v.push_back(c);
  sort(v.begin(), v.end());
  for (i = v[0]; i < v[1]; i++) {
    s += a[i];
  }
  for (i = 1; i < v[0]; i++) d += a[i];
  for (i = v[1]; i <= n; i++) d += a[i];
  mn = min(s, d);
  cout << mn;
}
