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