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_stations = int(input())

dist_stations = input().split()
dist_stations = [int(x) for x in dist_stations]

objective_stations = input().split()
objective_stations = [int(x) for x in objective_stations]

starting_station = objective_stations[0] - 1
final_station = objective_stations[1] - 1

dist_between_stations_clockwise = 0
dist_betweem_stations_counter_clockwise = 0

#clockwise
while starting_station != final_station:
  starting_station += 1
  starting_station = starting_station % (n_stations)
  dist_between_stations_clockwise += dist_stations[starting_station-1]



starting_station = objective_stations[0] - 1

#counter clockwise
while starting_station != final_station:
  final_station += 1
  final_station = final_station % n_stations

  dist_betweem_stations_counter_clockwise += dist_stations[final_station-1]

print(min(dist_betweem_stations_counter_clockwise, dist_between_stations_clockwise))
 			 		  					 		   	  			 	 		