n = gets ; n = n.to_i
arr = []
ab = []
n.times do
  ab = gets.split(" ").map(&:to_i)
  arr << {ab: (ab[0] + ab[1]), a: ab[0], b: ab[1]}
end
arr = arr.sort {|a,b| a[:ab] <=> b[:ab]}.reverse

result = 0
arr.each.with_index do |hash, index|
  result = result + hash[:a] if index.even?
  result = result - hash[:b] if index.odd?
end

puts result
