N = int(input()) s, t = map(int, input().split()) A = [int(x) for x in input().split()] B = [A[(i + s) % N] for i in range(N)] s, t = 0, t - s a, b = t - s - 1, N - t - 1 ans = -sum(A) if a % 2 == 0 and b % 2 == 0: ans += 2 * (sum(A[0:a // 2+1]) + sum(A[N - b // 2:])) elif a % 2 == 1 and b % 2 == 0: ans += 2 * (sum(A[0:(a+1) // 2+1]) + sum(A[N - b // 2:])) elif a % 2 == 0 and b % 2 == 1: ans += 2 * (sum(A[0:a // 2+1]) + sum(A[N - (b+1) // 2:])) else: ans += 2 * max(sum(A[0:a // 2+1]) + sum(A[N - (b+1) // 2:]), sum(A[0:(a+1) // 2+1]) + sum(A[N - b // 2:])) print(ans)