n=gets.to_i
mat = Array.new(2){gets.split.map(&:to_i)}.transpose
f=0
 
(0..1<<n).each do |bit|
  tmp = 0
  (0..n-1).each do |i|
    if bit[i] == 1
      tmp+=mat[i][0]-mat[i][1]
    end
  end
  
  if tmp > f
    f = tmp
  end
  
end
 
p f