#include <bits/stdc++.h>
using namespace std;
int main() {
  int s, n, f[1000], d[1000], a, b;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> f[i];
    d[i] = d[i - 1] + f[i];
    s += f[i];
  }
  cin >> a >> b;
  if (a > b) swap(a, b);
  cout << min(s - (d[b - 1] - d[a - 1]), d[b - 1] - d[a - 1]);
}
