n = gets.chomp.to_i
a = []
b = []
sum = []

(0...n).each do |i|
    j, k = gets.chomp.split(' ').map(&:to_i)
    a.push(j)
    b.push(k)
    sum.push([i, j+k])
end

sum.sort_by! {|i, j| j}

a_happy = 0
b_happy = 0
(0...n).each do |i|
    if i % 2 == 0
        a_happy += a[sum[i][0]]
    else
        b_happy += b[sum[i][0]]
    end
end

puts a_happy - b_happy