#include <bits/stdc++.h>
using namespace std;
int n, st, fin, ans;
int main() {
  scanf("%d", &n);
  vector<int> dis(n + 1);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &dis[i]);
  }
  scanf("%d%d", &st, &fin);
  int pos = st, road = 0, road1 = 0;
  while (pos != fin) {
    road += dis[pos];
    if (pos == n)
      pos = 1;
    else
      pos++;
  }
  pos = st;
  while (pos != fin) {
    if (pos != 1)
      road1 += dis[pos - 1];
    else
      road1 += dis[n];
    if (pos == 1)
      pos = n;
    else
      pos--;
  }
  printf("%d", min(road, road1));
  return 0;
}
