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