#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d[101], s, t, l1 = 0, l2 = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> d[i];
  }
  cin >> s >> t;
  if (s > t) {
    int k = s;
    s = t;
    t = k;
  }
  for (int i = 1; i <= n; ++i) {
    if (i < s || i >= t)
      l1 += d[i];
    else
      l2 += d[i];
  }
  cout << (l1 < l2 ? l1 : l2) << endl;
  return 0;
}
