n = gets.to_i

Pair = Struct.new(:val, :point)

a = Array.new(n).map{Pair.new(0,0)}
b = Array.new(n).map{Pair.new(0,0)}
for i in 0...n
    a[i].val, b[i].val = gets.split.map(&:to_i)
    a[i].point = a[i].val + b[i].val
    b[i].point = a[i].val + b[i].val
end

a = a.sort do |x, y|
    x.point <=> y.point
end

b = b.sort do |x, y|
    x.point <=> y.point
end

a.reverse!
b.reverse!

suma = 0
sumb = 0
for i in 0...n
    if i % 2 == 0
        suma += a[i].val
    else
        sumb += b[i].val
    end
end

puts suma - sumb