#include <bits/stdc++.h>
using namespace std;
int main() {
  int numb_of_station;
  std::cin >> numb_of_station;
  int first_station, second_station, pos_dist, neg_dist;
  vector<int> distance(numb_of_station);
  for (int i = 0; i < numb_of_station; ++i) {
    std::cin >> distance[i];
  }
  std::cin >> first_station >> second_station;
  if (first_station > second_station) {
    std::swap(first_station, second_station);
  }
  --first_station;
  --second_station;
  pos_dist = 0;
  neg_dist = 0;
  for (int i = first_station; i < second_station; ++i) {
    pos_dist += distance[i];
  }
  for (int i = second_station; i < numb_of_station; ++i) {
    neg_dist += distance[i];
  }
  for (int i = 0; i < first_station; ++i) {
    neg_dist += distance[i];
  }
  std::cout << std::min(pos_dist, neg_dist) << std::endl;
}
