#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> ivec;
  for (int i = 0; i != n; ++i) {
    int tmp;
    cin >> tmp;
    ivec.push_back(tmp);
  }
  int min, max;
  cin >> min >> max;
  int tmp1 = min < max ? min : max;
  int tmp2 = min > max ? min : max;
  min = tmp1;
  max = tmp2;
  int all = 0, part1 = 0, part2;
  for (int i = 0; i != ivec.size(); ++i) all += ivec[i];
  for (int i = min - 1; i != max - 1; ++i) part1 += ivec[i];
  part2 = all - part1;
  cout << (part1 < part2 ? part1 : part2) << endl;
  return 0;
}
