N = int(input()) s, t = map(int, input().split()) s-=1;t-=1 a = list(map(int, input().split())) sm = sum(a) if (s+1)%N==t: b2 = 0 for i in range(N//2): b2 += a[(t+i)%N] print(sm-2*b2) exit() if (t+1)%N==s: b1 = 0 for i in range((N+1)//2): b1 += a[(s+i)%N] print(2*b1-sm) exit() a = a+a if s