#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> dist(n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> dist[i];
    sum += dist[i];
  }
  int x, y;
  cin >> x >> y;
  if (x > y) swap(x, y);
  int x_to_y = 0;
  for (int i = x - 1; i < y - 1; i++) x_to_y += dist[i];
  int y_to_x = sum - x_to_y;
  cout << min(x_to_y, y_to_x) << endl;
  return 0;
}
