require 'ostruct'

n = gets.to_i

a = Array.new(n).map{OpenStruct.new}
b = Array.new(n).map{OpenStruct.new}
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

suma = 0
sumb = 0
cnt = 0
while a.size > 0 && b.size > 0
    aa = a.pop
    bb = b.pop
    if cnt % 2 == 0
        suma += aa.val
    else
        sumb += bb.val
    end
    cnt += 1
end

puts suma - sumb