N=int(input()) A=list(map(int,input().split())) M=sum(A[1::2])-sum(A[::2]) B=M for i in range(N): M+=2*(A[2*i]-A[2*i+1]) if B