N=int(input()) A=list(map(int,input().split())) LS=[0] RS=[0] for i in range(N): LS.append(LS[-1]+A[i*2]-A[i*2+1]) for i in range(N): RS.append(RS[-1]+A[-i*2-1]-A[i*2-2]) ANS=-1<<63 for i in range(1,N+1): ANS=max(ANS,LS[i]+RS[N-i]) print(ANS)