Imports System
Module Module1

    Sub Main()

        Dim n As Integer = Console.ReadLine
        Dim a(n) As Double
        Dim b(n) As Double
        Dim ab(n) As Double
        For i As Integer = 1 To n
            Dim temp() As String = Split(Console.ReadLine)
            a(i) = CDbl(temp(0))
            b(i) = CDbl(temp(1))
            ab(i) = a(i) + b(i)
        Next i

        Dim s As Double = 0
        Dim idx As Integer

        For i As Integer = 1 To n
            idx = 0
            For j As Integer = i To n
                If ab(j) > ab(idx) Then
                    idx = j
                End If
            Next
            If i Mod 2 = 1 Then
                s += a(idx)
            Else
                s -= b(idx)
            End If
            ab(idx) = ab(1)
            a(idx) = a(1)
            b(idx) = b(1)
        Next i

        Console.WriteLine(s)

    End Sub

End Module
