DBG = true
n = gets.to_i
ab = []
for i in 0...n
  a,b = gets.split.map{|z| z.to_i}
  ab << [a,b]
end
ab.sort_by!{|z| -z[0]-z[1]}
pa = 0
pb = 0
for i in 0...n
  if i%2 == 0
    pa += ab[i][0]
  else
    pb += ab[i][1]
  end
end
puts "#{pa-pb}"
