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