N = gets.to_i

list = N.times.collect{
	gets.strip.split(/ /).collect{|n| n.to_i}
}

i = -1
st_a = list.collect{|a, b|
	i += 1
	[a + b, a, i]
}.sort.reverse

i = -1
st_b = list.collect{|a, b|
	i += 1
	[a + b, b, i]
}.sort.reverse

count = N
index_a = 0
index_b = 0
used = {}
sum_a = 0
sum_b = 0
N.times{|i|
	if i % 2 == 0
		while true
			sum, a, n = st_a[index_a]
			unless used[n]
				sum_a += a
				used[n] = true
				break
			end
			index_a += 1
		end
	else
		while true
			sum, b, n = st_b[index_b]
			unless used[n]
				sum_b += b
				used[n] = true
				break
			end
			index_b += 1
		end
	end
}
puts sum_a - sum_b
