n = gets.to_i
a,b,c = [],[],[]

n.times do |i|
    ai,bi = gets.split.map &:to_i
    a[i] = ai
    b[i] = bi
    c[i] = ai,bi
end

sorted = c.sort{|x,y|y[0] + y[1] <=> x[0] + x[1]}

takahasi = 0
aoki = 0

n.times do |i|
    if i % 2 == 0
        takahasi += sorted[i][0]
    else
        aoki += sorted[i][1]
    end
end

puts takahasi - aoki