from itertools import accumulate N = int(input()) A = list(map(int, input().split())) ae = list(accumulate([0] + A[0::2])) ao = list(accumulate([0] + A[1::2])) ans = -10**17 for i in range(N+1): homu = ae[i] - ae[0] + ao[N] - ao[i] ten = ao[i] - ao[0] + ae[N] - ae[i] s = homu - ten if s > ans: ans = s print(ans)