import sys readline = sys.stdin.readline N = int(readline()) if N == 1: print(0) else: s, t = map(int, readline().split()) s -= 1 t -= 1 A = list(map(int, readline().split())) A = A[s:] + A[:s] t = (t-s)%N total = sum(A) X = A[0] C1 = A[1:t] C2 = A[N-1:t:-1] l1 = len(C1) l2 = len(C2) if l1 & 1 and l2 & 1: X += max(sum(C1[:l1//2])+sum(C2[:1+l2//2]), sum(C1[:1+l1//2])+sum(C2[:l2//2])) else: X += sum(C1[:(l1+1)//2]) + sum(C2[:(l2+1)//2]) ans = 2*X - total print(ans)