N = gets.to_i
AB = $<.map{|s| s.split.map(&:to_i) }

A = [*0...N]
A.sort_by!{|i|
	a = AB[i][0]
	b = AB[i][1]
	[a + b, a, b]
}.reverse

B = [*0...N]
B.sort_by!{|i|
	a = AB[i][0]
	b = AB[i][1]
	[a + b, b, a]
}.reverse

used = [false] * N
rest = N

i = j = 0
taka = 0
ao = 0
loop {
	i+=1 while used[A[i]]
	taka += AB[A[i]][0]
	used[A[i]] = true
	rest -= 1
	break if rest == 0

	j+=1 while used[B[j]]
	ao += AB[B[j]][1]
	used[B[j]] = true
	rest -= 1
	break if rest == 0
}

p taka - ao
