import sys input=lambda: sys.stdin.readline().rstrip() n=int(input()) s,t=map(int,input().split()) A=[int(i) for i in input().split()] sign=1 if s>t: s,t=t,s sign=-1 a,b=t-s-1,n-(t-s+1) ans=0 s-=1 t-=1 if a%2==0 or b%2==0: for i in range(n): if i<=s: if s-i<=i+n-t: ans+=A[i] else: ans-=A[i] elif i<=t: if i-s<=t-i: ans+=A[i] else: ans-=A[i] else: if n+s-i<=i-t: ans+=A[i] else: ans-=A[i] print(sign*ans) else: dif=0 for i in range(n): if i<=s: if s-i=0: print(ans+dif) else: print(ans-dif) else: if dif>=0: print(-ans+dif) else: print(-ans-dif)