#include <bits/stdc++.h>
using namespace std;
int a[10000];
int s, t;
int max(int x, int y) { return x < y ? x : y; }
int main() {
  int n, sm, sn, k;
  while (~scanf("%d", &n)) {
    memset(a, 0, sizeof(a));
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    scanf("%d%d", &s, &t);
    if (s > t) {
      k = s;
      s = t;
      t = k;
    }
    if (s == t) {
      printf("0\n");
      continue;
    } else {
      sm = 0, sn = 0;
      for (int i = 1; i < s; i++) sm += a[i];
      for (int i = t; i <= n; i++) sm += a[i];
      for (int i = s; i < t; i++) sn += a[i];
      printf("%d\n", max(sn, sm));
    }
  }
  return 0;
}
