#include <bits/stdc++.h>
using namespace std;
ifstream fin("input.txt");
ofstream fout("output.txt");
int n, d[102], s, t, sum1, sum2, sum3;
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
    sum1 += d[i];
  }
  cin >> s >> t;
  if (t < s) swap(s, t);
  for (int i = s; i < t; i++) sum2 += d[i];
  sum3 = sum1 - sum2;
  cout << min(sum3, sum2);
  return 0;
}
