n = int(input()) a = list(map(int,input().split())) m = sum(a[1::2])-sum(a[0::2]) mx = m for i in range(n): m -= 2*(a[i*2+1] - a[i*2]) mx = max(mx, m) print(mx)