Imports System
Module Module1

    Sub Main()

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

        Dim idx(n) As Integer
        Dim t As Integer
        For i As Integer = 1 To n
            t = 1
            For j As Integer = 2 To n
                If ab(j) > ab(t) Then
                    t = j
                End If
            Next j
            ab(t) = 0
            idx(i) = t
        Next i

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

        Console.WriteLine(s)

    End Sub

End Module
