#include <bits/stdc++.h>
using namespace std;
int min(int x, int y) {
  if (x > y)
    return y;
  else
    return x;
}
int max(int x, int y) {
  if (x > y)
    return x;
  else
    return y;
}
int main() {
  int n, a[100], b[100], f = 0, s = 0, l, r, i, j;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    s = s + a[i];
    b[i] = s;
  }
  cin >> l >> r;
  if (l == r)
    cout << "0";
  else {
    if (min(l, r) == 1)
      s = b[max(l, r) - 2];
    else
      s = b[max(l, r) - 2] - b[min(l, r) - 2];
    if (min(l, r) == 1)
      f = b[n - 1] - b[max(l, r) - 2];
    else
      f = b[n - 1] - b[max(l, r) - 2] + b[min(l, r) - 2];
    cout << min(s, f);
  }
  return 0;
}
