n=int(input())
arr1=list(map(int,input().split()))
counter=0
x=0
if(n%2==0):
    x=int(n/2)
else:
    x=int(n/2)-1
for i in range(0,x,1):
    if arr1[i]<arr1[i+n-2]:
        counter+=arr1[i]
    else:
        counter+=arr1[i+n-1]
print(counter)