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