#include <bits/stdc++.h>
using namespace std;
int n, ar[1010], vis[1010];
int x, y, sum, ans = 1e9;
vector<pair<int, int>> v[1010];
void tap(int z) {
  if (z == y) {
    ans = min(ans, sum);
    return;
  }
  for (int i = 0; i < v[z].size(); i++)
    if (vis[v[z][i].first] == 0)
      sum += v[z][i].second, vis[z] = 1, tap(v[z][i].first),
                             sum -= v[z][i].second;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
    if (i < n) v[i].push_back({i + 1, ar[i]}), v[i + 1].push_back({i, ar[i]});
    if (i == n) v[i].push_back({1, ar[i]}), v[1].push_back({i, ar[i]});
  }
  cin >> x >> y;
  tap(x);
  cout << ans;
}
