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