def select_dish(target = [], other = [], t_max, o_max)
  target_index = if t_max < o_max
    max_index = other.size.times.select{|x| o_max == other[x]}
    if max_index.size > 1
      max_value = 0
      return_index = 0
      max_index.each do |index|
        if max_value < target[index]
          return_index = index
        end
      end
      return_index
    else
      max_index.first
    end
  else
    max_index = target.size.times.select{|x| t_max == target[x]}
    if max_index.size > 1
      max_value = 0
      return_index = 0
      max_index.each do |index|
        if max_value < other[index]
          return_index = index
        end
      end
      return_index
    else
      max_index.first
    end
  end
end

N = gets.chomp.to_i
takahashi = []
aoki = []
0.upto(N-1) do |n|
  takahashi[n], aoki[n] = gets.chomp.split(' ').map(&:to_i)
end
takahashi_value = 0
aoki_value = 0
1.upto(N) do |n|
  if n.odd?
    index = select_dish(takahashi, aoki, takahashi.max, aoki.max)
    takahashi_value += takahashi[index]
  else
    index = select_dish(aoki, takahashi, aoki.max, takahashi.max)
    aoki_value += aoki[index]
  end
  takahashi.delete_at index
  aoki.delete_at index
end
puts takahashi_value - aoki_value