N = gets.to_i

Deliciousity = [*0...N].map{ gets.split.map &:to_i }

Deliciousity_sorted_by_sum = Deliciousity.sort_by{|d| -d.inject(0, :+)}

takahashi_point = 0
aoki_point = 0

for i in 1..N do
	if i.odd? then
		takahashi_point += Deliciousity_sorted_by_sum[i - 1][0]
	else
		aoki_point += Deliciousity_sorted_by_sum[i - 1][1]
	end
end

p takahashi_point - aoki_point
