#include <bits/stdc++.h>
using namespace std;
const int N = 100;
int d[N + 5];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> d[i];
  int s, t;
  cin >> s >> t;
  if (s == t) {
    cout << 0;
    return 0;
  }
  if (s < t) {
    long long sum1 = 0;
    for (int i = s; i < t; i++) sum1 = sum1 + d[i];
    long long sum2 = 0;
    for (int i = 1; i < s; i++) sum2 = sum2 + d[i];
    for (int i = t; i < n; i++) sum2 = sum2 + d[i];
    sum2 = sum2 + d[n];
    cout << min(sum1, sum2);
    return 0;
  }
  if (s > t) {
    long long sum1 = 0;
    for (int i = s; i < n; i++) sum1 = sum1 + d[i];
    sum1 = sum1 + d[n];
    for (int i = 1; i < t; i++) sum1 = sum1 + d[i];
    long long sum2 = 0;
    for (int i = t; i < s; i++) sum2 = sum2 + d[i];
    cout << min(sum1, sum2);
    return 0;
  }
  return 0;
}
