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