N = gets.to_i
A = gets.split.map(&:to_i) # N+1
B = gets.split.map(&:to_i) # N

Decrease = lambda{|iA, iB|
	A[iA], B[iB] = (A[iA] < B[iB]) ? [0, B[iB]-A[iA]] : [A[iA]-B[iB], 0]
}

A0 = A.inject(&:+)
(0..(N/2)).each{|i|
	Decrease[i  , i]
	Decrease[i+1, i]
	Decrease[N-i  , N-i-1]
	Decrease[N-i-1, N-i-1]
}
A1 = A.inject(&:+)

p A0-A1
