N = gets.to_i
A = []
B = []
x = []
for i in 0..N-1

    x[i] = []

    A[i],B[i] = gets.split.map(&:to_i)

    x[i][0] = A[i]+B[i]
    x[i][1] = i 

end

x.sort!{|a,b| a[0] <=> b[0]}
a = 0
b = 0

for i in 0..N-1

    if i % 2 == 0

        a += A[x[N-1-i][1]]

    else

        b += B[x[N-1-i][1]]

    end

end

puts a-b

