N = gets.to_i

foods = N.times.map { gets.split.map(&:to_i) }

foods.sort_by! { |a, b| -(a + b) }

sumA = 0
sumB = 0

N.times do |i|
  a, b = foods[i]

  if i.even?
    sumA += a
  else
    sumB += b
  end
end

puts sumA - sumB
