#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a[100];
  int s, t, p, b, z, result;
  while (cin >> n) {
    z = 0;
    p = 0;
    for (int i = 0; i < n; i++) cin >> a[i];
    cin >> s >> t;
    if (s > t) {
      b = s;
      s = t;
      t = b;
    }
    for (int i = s - 1; i < t - 1; i++) p = p + a[i];
    for (int i = 0; i < n; i++) z = z + a[i];
    result = z - p;
    if (result > p)
      cout << p << endl;
    else
      cout << result << endl;
  }
  return 0;
}
