n = gets.chomp.to_i
ab = []
n.times do
  a, b = gets.chomp.split(" ").map(&:to_i)
  score = [a, b].max
  ab << [a, b, score]
end

ab.sort_by!{|x| x[2]}.reverse!

takahashi = 0
aoki = 0
n.times do |i|
  if (i + 1).odd?
    takahashi += ab[i][0]
  else
    aoki += ab[i][1]
  end
end

puts takahashi - aoki