#include <bits/stdc++.h>
using namespace std;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
vector<int> g[N];
int main() {
  ios_base::sync_with_stdio(0);
  int t, i, j, k, p, q, r, x = 0, y, u = 0, v, n = 1, m = 0;
  cin >> t;
  int a[t];
  for (int p = 1; p <= t; p++) {
    cin >> a[p];
    u += a[p];
  }
  cin >> j >> k;
  if (j > k) swap(j, k);
  for (int p = j; p < k; p++) x += a[p];
  int ans = min(x, u - x);
  cout << ans;
  return 0;
}
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((long long)result * base) % mod;
    base = ((long long)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
void ipgraph(int n, int m) {
  int i, u, v;
  while (m--) {
    cin >> u >> v;
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
}
