N = gets.to_i
A,B = N.times.map{gets.split.map(&:to_i)}.transpose
S = N.times.sort_by{|i| A[i] + B[i] }.reverse
pa = pb = 0
S.each_with_index do |s, i|
  if i.even?
    pa += A[s]
  else
    pb += B[s]
  end
end
puts pa - pb