#include <bits/stdc++.h>
using namespace std;
int main() {
  int s, t, i, j, n;
  scanf("%d", &n);
  int a[n];
  for (i = 0; i < n; i++) scanf("%d", a + i);
  scanf("%d%d", &s, &t);
  s--, t--;
  if (s > t) swap(s, t);
  int Min = 0, c = 0;
  for (i = s; c < t - s; i = (i + 1) % n, c++) Min += a[i];
  j = 0;
  c = 0;
  for (i = (s + n - 1) % n; c < (n - t + s); i = (i + n - 1) % n, c++)
    j += a[i];
  printf("%d", min(Min, j));
  return 0;
}
