takahashi = []
aoki = []
array = []

N = gets.chomp.to_i

for i in 0..(N - 1)
  takahashi[i], aoki[i] = gets.chomp.split(' ').map(&:to_i)
end

for i in 0..(N - 1)
  array[i] = [(takahashi[i] - aoki[i]).abs, takahashi[i] ,aoki[i]]
end
array.sort! {|a,b| a[0] <=> b[0] || a[1] <=> b[1]}.reverse!

ans_taka = 0
ans_ao = 0
for i in 0..(N - 1)
  if i % 2 == 0
    ans_taka += array[i][1]
  else
    ans_ao += array[i][2]
  end
end

print ans_taka - ans_ao