import numpy as np n = int(input()) A = list(map(int,input().split())) L = [a for a in A[::2]] R = [a for a in A[1::2]] cumL = np.cumsum(L) cumR = np.cumsum(R) sumA = sum(A) ans = 0 for i in range(n): h = cumL[i] + cumR[-1]-cumR[i] t = sumA - h ans = max(ans, h-t) print(ans)