#include <bits/stdc++.h>
using namespace std;
int main() {
  int d[101];
  memset(d, -1, sizeof(d));
  int n;
  int sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    sum += d[i];
  }
  int s, t;
  cin >> s >> t;
  int short_dist = 0;
  if (t != s) {
    if (t < s) swap(s, t);
    for (int i = s - 1; i < t - 1; i++) {
      short_dist += d[i];
    }
    if (2 * short_dist > sum) short_dist = sum - short_dist;
  }
  cout << short_dist << endl;
  return 0;
}
