import sys readline = sys.stdin.readline INF = 10**15 D = dict() def rec(i, j, k, l): if i+1 == j and k+1 == l: return 0 if (i, j, k, l) in D: return D[(i, j, k, l)] res = -INF if (j-i + l-k) %2 == N%2: if i+1 < j: res = max(res, C1[i+1]-rec(i+1, j, k, l)) if k+1 < l: res = max(res, C2[k+1]-rec(i, j, k+1, l)) else: if i+1 < j: res = max(res, C1[j-1]-rec(i, j-1, k, l)) if k+1 < l: res = max(res, C2[l-1]-rec(i, j, k, l-1)) D[(i, j, k, l)] = res return res N = int(readline()) 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(A[0] - A[t] + rec(-1, l1, -1, l2))