#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int dis[110];
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &dis[i]);
    sum += dis[i];
  }
  int begin, dest;
  scanf("%d%d", &begin, &dest);
  if (begin > dest) {
    int temp = begin;
    begin = dest;
    dest = temp;
  }
  int possum = 0;
  for (int i = begin - 1; i < dest - 1; ++i) {
    possum += dis[i];
  }
  if (possum <= sum / 2)
    printf("%d\n", possum);
  else
    printf("%d\n", sum - possum);
  return 0;
}
