#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s, t, *a, sum1 = 0, sum2 = 0;
  cin >> n;
  a = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum1 += a[i];
  }
  cin >> s >> t;
  if (s > t) swap(s, t);
  for (int i = s; i < t; i++) {
    sum2 += a[i - 1];
  }
  sum1 -= sum2;
  if (sum1 < sum2)
    cout << sum1 << endl;
  else
    cout << sum2 << endl;
  return 0;
}
