#include <bits/stdc++.h>
using namespace std;
int main() {
  int Data1, Search[1001], Target1, Target2;
  cin >> Data1;
  for (int i = 0; i < Data1; i++) cin >> Search[i];
  cin >> Target1 >> Target2;
  if (Target1 == Target2) return cout << 0, 0;
  int Test1 = Target1, Test2 = Target2, Attack1 = 0, Attack2 = 0;
  if (Target1 > Target2) swap(Target1, Target2);
  for (int i = Target1 - 1; i < Target2 - 1; i++) Attack1 += Search[i];
  for (int i = Target2 - 1; i < Data1; i++) Attack2 += Search[i];
  for (int i = 0; i < Target1 - 1; i++) Attack2 += Search[i];
  cout << min(Attack1, Attack2);
  return 0;
}
