#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int s, t;
  cin >> s >> t;
  int s1 = 0;
  for (int i = min(s, t) - 1; i < max(s, t) - 1; i++) {
    s1 += arr[i];
  }
  int s2 = 0;
  for (int i = max(s, t) - 1; i < n; i++) {
    s2 += arr[i];
  }
  for (int i = 0; i < min(s, t) - 1; i++) {
    s2 += arr[i];
  }
  if (s1 < s2)
    cout << s1;
  else
    cout << s2;
}
