#include <bits/stdc++.h>
const int maxn = 110;
int dis[maxn];
int main() {
  int n, i, s, t, ans, d, sum;
  while (scanf("%d", &n) != EOF) {
    sum = 0;
    for (i = 1; i <= n; i++) {
      scanf("%d", &dis[i]);
      sum += dis[i];
    }
    scanf("%d%d", &s, &t);
    if (s > t) {
      d = s;
      s = t;
      t = d;
    }
    d = 0;
    for (i = s; i < t; i++) d += dis[i];
    ans = d;
    d = sum - d;
    if (ans > d) ans = d;
    printf("%d\n", ans);
  }
  return 0;
}
