def main()
  n = gets.chomp.to_i
  a = []
  b = []
  sum_ary = []
  result = 0
  for i in 0..(n-1) do
    a[i], b[i] = gets.chomp.strip.split(' ').map(&:to_i)
    sum_ary[i] = a[i] + b[i]
    result -= b[i]
  end

  sum_ary = sum_ary.sort.reverse
  index=0
  while sum_ary.size > index do
    result += sum_ary[index] if index.even?
    index += 1
  end
  
  puts "#{result}"
end
main
