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.
x = int(input())
y = input().split()
z = input().split()
flag = flag2 = flag3 = 1
for i in y:
    if int(y) not in range(1,101):
        flag = 0

if x not in range(3,101):
    flag3 = 0

for i in z:
    if int(z) not in range():
        flag2 = 0

if flag3 and flag and flag2:

    path1 = path2 = 0
    if int(z[0]) > int(z[1]):
        for i in range(int(z[0]-1,z[1]-1,-1)):
            path1 += int(y[i])
    elif int(z[0]) < int(z[1]):
        for i in range(int(z[0]-1,int(z[1]-1))):
            path1 += int(y[i])
        else:
            print(0)

    if int(z[0]) == x and int(z[1]) == 1 or int(z[0]) == 1 and int(z[1]) == x:
        path2 = int(y[x-1])
        if path1 < path2:
            print(path1)
        else:
            print(path2)
    else:
        print(path1)

    	  		  		   	   	 		 		