N = int(input()) s, t = map(int, input().split()) s, t = s - 1, t - 1 A = list(map(int, input().split())) L1, L2 = [], [] now = s + 1 while (now - t) % N: L1.append(A[now % N]) now += 1 now = (s - 1) % N while (now - t) % N: L2.append(A[now % N]) now -= 1 S = sum(A) val = 0 N1, N2 = len(L1), len(L2) if N1 % 2 and N2 % 2: val = max(sum(L1[:N1//2]) + sum(L2[:N2//2 + 1]), sum(L1[:N1//2 + 1]) + sum(L2[:N2//2])) else: val = sum(L1[:(N1 + 1)//2]) + sum(L2[:(N2 + 1)//2]) print(2 * val - S + A[s] * 2)