#include <bits/stdc++.h>
int edge[110][110];
int main() {
  memset(edge, 0, sizeof(edge));
  int n, u, v, w;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &w);
    edge[i % n][(i + 1) % n] = edge[(i + 1) % n][i % n] = w;
  }
  scanf("%d%d", &u, &v);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) {
      if (i == j)
        edge[i][j] = 0;
      else if (edge[i][j] == 0)
        edge[i][j] = 1000000;
    }
  for (int k = 0; k < n; ++k)
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) {
        if (i == k || j == k) continue;
        if (edge[i][j] > edge[i][k] + edge[k][j])
          edge[i][j] = edge[i][k] + edge[k][j];
      }
  printf("%d\n", edge[u - 1][v - 1]);
  return 0;
}
