def judge(a, b): if b % 2 == 0: if a <= b//2: return 0 else: return 100 if b % 2 != 0: if a < (b+1)//2: return 0 elif a == (b+1)//2: return 1 else: return 100 def main(): N = int(input()) s, t = map(int, input().split()) A = list(map(int, input().split())) if s > t: s = N+1-s t = N+1-t A = A[::-1] R = A[s:t-1] L = A[t:] + A[:s-1] L = L[::-1] len_R = len(R) len_L = len(L) K = (N-1)//2 ans = A[s-1] Sum_A = sum(A) R.insert(0, 0) L.insert(0, 0) for i in range(1, len_R+1): R[i] += R[i-1] for i in range(1, len_L+1): L[i] += L[i-1] for i in range(len_R+1): if 0 <= K-i <= len_L: try_max = L[K-i] + R[i] + A[s-1] if try_max > ans: ban = 0 ban += judge(K-i, len_L) + judge(i, len_R) if ban <= 1: ans = try_max res = 2*ans - Sum_A print(res) return if __name__ == "__main__": main()