#include <bits/stdc++.h>
using namespace std;
int n, dist[111];
int next(int src) {
  if (src == n)
    return 1;
  else
    return src + 1;
}
int get(int s, int t) {
  int res = 0, cur = s;
  while (1) {
    if (cur == t) break;
    res += dist[cur];
    cur = next(cur);
  }
  return res;
}
int main(void) {
  int s, t;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> dist[i];
  cin >> s >> t;
  int d1 = get(s, t);
  int d2 = get(t, s);
  cout << min(d1, d2) << endl;
  return 0;
}
