n = gets.to_i
a =[]
b =[]
c =[]
n.times do
    aa,bb = gets.split(" ").map(&:to_i)
    a << aa
    b << bb
    c << (aa + bb)
end
ans = 0
for i in 0 ..n-1 do
    idx = c.index(c.max)
    if i%2 == 0
        ans += a[idx]
    else
        ans -= b[idx]
    end
    c[idx] = 0
end
puts ans