n=gets.to_i

abs = []
n.times do
  abs << gets.split.map(&:to_i)
end

abs = abs.map { |a,b|
  sum = a+b
  [a,b,sum]
}.sort_by {|a,b,sum| -sum}

tp = 0
ap = 0

f = true
abs.each do |a,b,sum|
  if f
    tp += a
  else
    ap += b
  end
  f = !f
end

p (tp-ap)