#include <bits/stdc++.h>
using namespace std;
int main() {
  int d[105], n, sum1 = 0, sum2 = 0, begin, end;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> d[i];
  cin >> begin >> end;
  if (begin > end) {
    int t;
    t = begin;
    begin = end;
    end = t;
  }
  for (int i = begin; i < end; i++) sum1 += d[i];
  for (int i = end; i != begin; i++) {
    sum2 += d[i];
    if (i >= n) i = 0;
  }
  sum1 = sum1 > sum2 ? sum2 : sum1;
  cout << sum1 << endl;
  return 0;
}
