#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s, t, ans = 0, sum = 0;
  cin >> n;
  int a[100];
  for (int i = 1; i <= n; ++i) cin >> a[i];
  cin >> s >> t;
  if (s == t) {
    cout << 0;
    return 0;
  }
  if (s > t) {
    swap(s, t);
  }
  for (int i = s; i < t; i++) ans += a[i];
  for (int i = t; i <= n; i++) sum += a[i];
  for (int i = 1; i < s; i++) sum += a[i];
  cout << min(sum, ans);
  return 0;
}
