#include <bits/stdc++.h>
using namespace std;
const string file = "A";
const string infile = file + ".in";
const string outfile = file + ".out";
int main() {
  ostream &fout = cout;
  istream &fin = cin;
  int N;
  fin >> N;
  vector<int> A(N, 0);
  for (int i = 0; i < N; ++i) {
    fin >> A[i];
  }
  int S, T;
  fin >> S >> T;
  S--;
  T--;
  if (S > T) swap(S, T);
  int Sum = accumulate(A.begin(), A.end(), 0);
  int Sol = 0;
  for (int i = S; i < T; i++) {
    Sol += A[i];
  }
  int cSol = Sum - Sol;
  Sol = min(Sol, cSol);
  fout << Sol << "\n";
}
