The circle line of the Berland subway has *n* stations. We know the distances between all pairs of neighboring stations:
-  *d*<sub class="lower-index">1</sub> is the distance between the 1-st and the 2-nd station;-  *d*<sub class="lower-index">2</sub> is the distance between the 2-nd and the 3-rd station;...-  *d*<sub class="lower-index">*n* - 1</sub> is the distance between the *n* - 1-th and the *n*-th station;-  *d*<sub class="lower-index">*n*</sub> is the distance between the *n*-th and the 1-st station.
The trains go along the circle line in both directions. Find the shortest distance between stations with numbers *s* and *t*.
The first line contains integer *n* (3 ≤ *n* ≤ 100) — the number of stations on the circle line. The second line contains *n* integers *d*<sub class="lower-index">1</sub>, *d*<sub class="lower-index">2</sub>, ..., *d*<sub class="lower-index">*n*</sub> (1 ≤ *d*<sub class="lower-index">*i*</sub> ≤ 100) — the distances between pairs of neighboring stations. The third line contains two integers *s* and *t* (1 ≤ *s*, *t* ≤ *n*) — the numbers of stations, between which you need to find the shortest distance. These numbers can be the same.

The numbers in the lines are separated by single spaces.
t=int(input())
arr=list(map(int,input().strip().split()))[:t]
a,b =map(int,input().split())
if(b>a):
	l=b
	b=a
	a=l
if(a>=b):
	ans1=0
	for i in range(a-1,b-1,-1):
		ans1=ans1+arr[i]
	ans2=0
	k=a-1
	while(1):
		ans2=ans2+arr[k]
		k+=1
		if(k==t):
			k=0
		if(k==b-1):
			break
	ans3=0
	for i in range(b-1,a-1):
		ans3=ans3+arr[i]
	ans4=0
	k=b-1
	while(1):
		ans4=ans4+arr[k]
		k-=1
		if(k==-1):
			k=t-1
		if(k==a-1):
			break
ans=min(ans1,ans2,ans3,ans4)
print(ans)
