n = gets.chomp.to_i
aList = []
bList = []
for i in (0..(n-1))
  num = gets.chomp.split(' ').map(&:to_i)
  aList << [i, num[0]]
  bList << [i, num[1]]
end
aList = aList.sort{ |a, b| a[1] <=> b[1] }.reverse
bList = bList.sort{ |a, b| a[1] <=> b[1] }.reverse
ascore = 0
bscore = 0
n.times do |i|
  if i % 2 == 0 # 高橋くん
    choice = aList[0]
    num = aList.shift
    bList.delete_if{ |a| a[0] == num[0] }
    ascore += num[1]
  else
    choice = bList[0]
    num = bList.shift
    aList.delete_if{ |a| a[0] == num[0] }
    bscore += num[1]
  end
end
puts ascore - bscore