#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[200] = {0}, n, x, S, T;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> x, a[i] = a[i - 1] + x;
  cin >> S >> T;
  if (S > T) swap(S, T);
  cout << min(a[T - 1] - a[S - 1], a[n] - a[T - 1] + a[S - 1]) << endl;
  return 0;
}
