n=gets.to_i
array=[]
n.times{
   array.push(gets.split.map(&:to_i)) 
}

array=array.sort_by{|i| i[0]+i[1]}.reverse
turn=1
taka=0
aoki=0
n.times{|j|
    if turn==1
        taka+=array[j][0]
    elsif turn==-1
        aoki+=array[j][1]
    end
    turn*=-1
}

puts taka-aoki