#include <bits/stdc++.h>
using namespace std;
long long n, d, s, t, a1, a2;
vector<long long> v;
int main() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> d;
    v.push_back(d);
  }
  cin >> s >> t;
  if (s == t) {
    cout << 0;
    return 0;
  }
  for (long long i = s - 1; i < n; i++) {
    if (i == t - 1) {
      break;
    }
    if (i == n - 1) {
      a1 += v[i];
      i = -1;
    } else {
      a1 += v[i];
    }
  }
  for (long long i = s - 1; i >= 0; i--) {
    if (i == t - 1) {
      break;
    }
    if (i == 0) {
      a2 += v[v.size() - 1];
      i = n;
    } else {
      a2 += v[i - 1];
    }
  }
  cout << min(a1, a2);
  cout << "\n";
  return 0;
}
