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.
n = int(input())
D = list(map(int, input().split()))
s, t = tuple(map(int, input().split()))

D_dict = {}
for i, d in enumerate(D):
    if i != len(D) - 1:
        key = (i, i+1)
        value = d
        D_dict[key] = value
    else:
        key = (i, 0)
        value = d
        D_dict[key] = value

s = s - 1
t = t - 1

if abs(s - t) > 0:
    distance = []
    for i in range(0, n):
        distance.append(i)

    start = distance.index(s)
    current = s
    distance_back = [current]

    while current != t:
        start -= 1
        current = distance[start]
        distance_back.append(current)

    start = distance.index(s)    
    current = s
    distance_forward = [current]

    while current != t:
        start += 1
        if start > len(distance) - 1:
            start = 0
        current = distance[start]
        distance_forward.append(current)

    print(D_dict)
    print(distance_forward)
    print(distance_back)
    
    c1 = 0
    c2 = 0
    previous = None
    for i, item in enumerate(distance_forward): 
        if i != 0:
            if (distance_forward[i-1], distance_forward[i]) in D_dict.keys():
                c1 += D_dict[(distance_forward[i-1], distance_forward[i])]
            else:
                c1 += D_dict[(distance_forward[i], distance_forward[i-1])]
    for i, item in enumerate(distance_back):
        if i != 0:
            if (distance_back[i-1], distance_back[i]) in D_dict.keys():
                c2 += D_dict[(distance_back[i-1], distance_back[i])]
            else:
                c2 += D_dict[(distance_back[i], distance_back[i-1])]
    print(min(c1, c2))
else:
    print(0)
