#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s, t;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> s >> t;
  if (s > t) {
    s += t;
    t = s - t;
    s -= t;
  }
  int c1 = 0, c2 = 0;
  for (int i = s - 1; i < t - 1; i++) {
    c1 += a[i];
  }
  for (int i = t - 1; i != s - 1; i++) {
    if (i > n - 1) {
      i = -1;
      continue;
    }
    c2 += a[i];
  }
  if (c1 > c2)
    cout << c2;
  else
    cout << c1;
  return 0;
}
