lines = readlines
n = lines.shift.chomp.to_i
ab = lines.map{|line| line.chomp.split(' ').map{|x| x.to_i}}

ab.sort_by!{|x| [-(x[0] + x[1]), -x[0]]}

taka = 0
aoki = 0
(0...n).each do |i|
  s = ab.shift
  if i % 2 == 0
    taka += s[0]
  else
    aoki += s[1]
  end
end

puts taka - aoki