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