#include <bits/stdc++.h>
int main() {
  int n, d[101] = {0}, i, s, t, k;
  for (scanf("%d", &n), i = 1; i <= n; i++) {
    scanf("%d", &d[i]);
    d[0] += d[i];
  }
  scanf("%d%d", &s, &t);
  if (s > t) {
    k = s;
    s = t;
    t = k;
  }
  k = 0;
  for (i = s; i < t; i++) k += d[i];
  d[0] -= k;
  printf("%d\n", k < d[0] ? k : d[0]);
  return 0;
}
