import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) def debug(*arg, sep=" ", end="\n"): print(*arg, sep=sep, end=end, file=sys.stderr) N = int(input()) S, T = map(int, input().split()) A = list(map(int, input().split())) get = (N + 1) // 2 acc = [0] * (N + N + 1) for i, a in enumerate(A, 1): acc[i] = acc[i-1] + a for i, a in enumerate(A, N + 1): acc[i] = acc[i-1] + a if S < T: S += N dL = S - T - 1 dR = T + N - S - 1 debug(dL, dR) ans = - 10 ** 18 for i in range(T, S): j = i + get debug((S, T), (i, j), acc[j] - acc[i]) L = S - i - 1 R = j - S debug(L, R) if L <= (dL + 1) // 2 and R <= (dR + 1) // 2: X = acc[j] - acc[i] Y = acc[N] - X ans = max(ans, X - Y) print(ans)