n = gets.chomp.to_i
a = []
b = []
diff = []
n.times do
    j, k = gets.chomp.split(' ').map(&:to_i)
    a.push(j)
    b.push(k)
    diff.push(j - k)
end

a_happy = 0
b_happy = 0
(1..n).each do |i|
    if i % 2 == 1
        # 高橋くんのターン
        index = diff.index(diff.min)
        a_happy += a[index]
    else
        # 青木さんのターン
        index = diff.index(diff.max)
        b_happy += b[index]
    end
    a.delete_at(index)
    b.delete_at(index)
    diff.delete_at(index)
end

puts a_happy - b_happy