N = gets.to_i
as = []
bs = []
N.times {
  a,b = gets.split.map &:to_i
  as << a; bs << b
}
cs = (0...N).to_a.sort_by{ |i| as[i] + bs[i] }.reverse
aa = 0
bb = 0
(0...N).each{ |i|
  if i%2 == 0
    aa += as[cs[i]]
  else
    bb += bs[cs[i]]
  end
}
p aa - bb
