#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  cin >> n;
  int a[1000];
  for (i = 1; i <= n; i++) cin >> a[i];
  int x, y, z;
  cin >> y >> z;
  if (y >= z)
    x = z;
  else {
    x = y;
    y = z;
  }
  int c = 0, d = 0, ma;
  for (i = x; i < y; i++) c += a[i];
  for (i = y; i != x; i++) {
    d += a[i];
    if (i == n) i = 0;
  }
  ma = min(c, d);
  if (x == y)
    cout << "0" << endl;
  else
    cout << ma << endl;
  return 0;
}
