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