#include <bits/stdc++.h>
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
unsigned long long lcd(unsigned long long a, unsigned long long b) {
  if (a % b == 0) return a;
  return a / gcd(a, b) * b;
}
unsigned long long lcd(unsigned long long a, unsigned long long b,
                       unsigned long long c) {
  unsigned long long l = lcd(a, b);
  return c * l / gcd(c, l);
}
unsigned long long lcd(unsigned long long a, unsigned long long b,
                       unsigned long long c, unsigned long long d) {
  unsigned long long l = lcd(a, b, c);
  return d * l / gcd(d, l);
}
bool isOdd(int a) { return a & 1; }
bool isEven(int a) { return !isOdd(a); }
unsigned long long binominal(long long fromN, long long toK) {
  unsigned long long res = 1;
  while (fromN > toK) {
    res *= fromN--;
  }
  while (toK > 0) res /= toK--;
  return res;
}
template <typename T, typename F>
int count_if_n(T val, size_t n, F f) {
  size_t count = 0;
  for (int i = 0; i < n; ++i) {
    if (f(*val)) ++count;
    if (i != n) ++val;
  }
  return count;
}
template <typename T, typename F>
int read_count_if_n(F f) {
  size_t size;
  std::cin >> size;
  return count_if_n(std::istream_iterator<T>(std::cin), size, f);
}
template <typename T, typename F>
int read_count_if_n(size_t n, F f) {
  return count_if_n(std::istream_iterator<T>(std::cin), n, f);
}
template <typename T = int>
std::vector<T> read_vector(size_t n = 0) {
  if (n == 0) std::cin >> n;
  std::vector<T> ret(n);
  std::copy_n(std::istream_iterator<T>(std::cin), n, ret.begin());
  return ret;
}
int MaxOnes(const std::string &s, size_t current, bool Changing = false) {
  if (current == 0) {
    if (Changing) return 1;
    return static_cast<int>(s[0] == '0');
  }
  static std::unordered_map<size_t, int> withChanging, withoutChanging;
  int ret;
  if (Changing) {
    auto found = withChanging.find(current);
    if (found != withChanging.end()) return found->second;
    int contChange = MaxOnes(s, current - 1, Changing) + (s[current] == '0');
    int interruptChange = std::count(s.begin(), s.begin() + (current + 1), '1');
    ret = std::max(contChange, interruptChange);
    withChanging[current] = ret;
  } else {
    auto found = withoutChanging.find(current);
    if (found != withoutChanging.end()) return found->second;
    ret = MaxOnes(s, current - 1, false) + (s[current] == '1');
    if (s[current] == '0')
      ret = std::max(ret, MaxOnes(s, current - 1, true) + 1);
    withoutChanging[current] = ret;
  }
  return ret;
}
unsigned long long numQuad(unsigned long long a, unsigned long long b) {
  auto min = std::min(a, b);
  auto max = a + b - min;
  if (a == 0 || b == 0) return 0;
  return max / min + numQuad(max % min, min);
}
int numLines(int n, int a, int b, int c) {
  if (n < 0) return std::numeric_limits<int>::min();
  if (n == 0) return 0;
  static int res[4001]{};
  if (res[n] != 0) return res[n];
  return (res[n] =
              (std::max({numLines(n - a, a, b, c), numLines(n - b, a, b, c),
                         numLines(n - c, a, b, c)}) +
               1));
}
std::string Int2Alpha(const std::string &s) {
  int i = std::stoi(s) - 1;
  std::string res;
  while (i >= 0) {
    res += 'A' + i % 26;
    i /= 26;
    i -= 1;
  }
  std::reverse(res.begin(), res.end());
  return res;
}
std::string Alpha2Int(const std::string &s) {
  int res = 0;
  for (char c : s) {
    res = res * 26 + c - 'A' + 1;
  }
  return std::to_string(res);
}
unsigned long long numDigits(unsigned long long x) {
  if (x < 10) return x;
  return numDigits(x / 10) * 10 + 2 * (x % 10) * x / 10 + x / 10;
}
char Get(const std::string &s, int i) {
  if (i >= s.size() || i < 0) return ' ';
  return s[i];
}
char Get(const std::vector<std::string> &v, int i, int j) {
  if (i >= v.size() || i < 0) return ' ';
  return Get(v[i], j);
}
std::vector<int> GenEratosphen(size_t n) {
  std::vector<bool> simples(n);
  simples[0] = simples[1] = true;
  int numPrimes = 0;
  for (int i = 2; i < 1000; ++i) {
    if (!simples[i]) {
      numPrimes += 1;
      for (int j = i * i; j < n; j += i) simples[j] = true;
    }
  }
  std::vector<int> out;
  out.reserve(numPrimes);
  for (int i = 2; i < n; ++i) {
    if (!simples[i]) out.push_back(i);
  }
  return out;
}
std::unordered_set<unsigned long long> GenEratosphen() {
  static char simples[1000000]{};
  simples[0] = simples[1] = true;
  int numPrimes = 0;
  for (int i = 2; i < 1000; ++i) {
    if (!simples[i]) {
      numPrimes += 1;
      for (int j = i * i; j < 1000000; j += i) simples[j] = true;
    }
  }
  std::unordered_set<unsigned long long> out;
  out.reserve(numPrimes);
  for (unsigned long long i = 2; i < 1000000; ++i) {
    if (!simples[i]) out.emplace(i * i);
  }
  return out;
}
int main() {
  using namespace std;
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> distances(n + 1);
  distances[0] = 0;
  for (int i = 1; i <= n; ++i) {
    int d;
    cin >> d;
    distances[i] = distances[i - 1] + d;
  }
  int p, q;
  cin >> p >> q;
  int dist1 = abs(distances[q - 1] - distances[p - 1]);
  cout << min(dist1, distances[n] - dist1) << endl;
}
