N = int(input()) A = list(map(int, input().split())) cuml = [0] cumr = [0] for i in range(N): cuml.append(cuml[-1] + A[2 * i] - A[2 * i + 1]) cumr.append(cumr[-1] + A[-2 * i - 1] - A[-2 * i - 2]) ans = -10**18 for i in range(N): ans = max(ans, cuml[i] + cumr[- i - 1]) print(ans)