Imports System
Module Module1

    Sub Main()

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

        Dim asum As Double = 0
        Dim bsum As Double = 0
        Dim idx As Integer
        Dim dif As Integer

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

        Console.WriteLine(asum - bsum)

    End Sub

End Module
