n = gets.to_i
dish = Array.new(n).map{Array.new(2, 0)}
for i in 0..n-1
  dish[i] = gets.split.map(&:to_i)
end
tk = Array.new(n, 0)
ao = 0
ans = 0
for i in 0..n-1
  tk[i] = dish[i][0] + dish[i][1]
  ao += dish[i][1]
end
tk.sort!
for i in 1..n
  if i % 2 == 1
    ans += tk[-i]
  end
end
puts ans - ao
