n = gets.chomp!.to_i

takahashi = []
aoki = []
tokuten = []

n.times do |i|
  a, b = gets.chomp!.split(" ").map(&:to_i)
  takahashi << a
  aoki << b
  tokuten << { idx: i, point: a + b }
end
tokuten.sort! { |a, b| b[:point] <=> a[:point] }

ans = 0
n.times do |i|
  if i.even?
    ans += takahashi[tokuten[i][:idx]]
  else
    ans -= aoki[tokuten[i][:idx]]
  end
end

puts ans
