import numpy as np



N = int(eval(input()))



arr = np.array([input().split() + [0] for _ in range(N)], dtype='int64')

for i in range(N):

    arr[i, 2] = arr[i, 0] + arr[i, 1]



arr = arr[np.argsort(arr[:, 2])][::-1]



print((np.sum(arr[::2, 0]) - np.sum(arr[1::2, 1])))
import numpy as np

import sys

input = sys.stdin.readline



N = int(eval(input()))



arr = np.array([input().split() + [0] for _ in range(N)], dtype='int64')

for i in range(N):

    arr[i, 2] = arr[i, 0] + arr[i, 1]



arr = arr[np.argsort(arr[:, 2])][::-1]



print((np.sum(arr[::2, 0]) - np.sum(arr[1::2, 1])))
import numpy as np

N = int(eval(input()))
arr = np.array([input().split() + [0] for _ in range(N)], dtype="int64")
for i in range(N):
    arr[i, 2] = arr[i, 0] + arr[i, 1]
arr = arr[np.argsort(arr[:, 2])][::-1]
print((np.sum(arr[::2, 0]) - np.sum(arr[1::2, 1])))

import numpy as np
import sys

input = sys.stdin.readline
N = int(eval(input()))
arr = np.array([input().split() + [0] for _ in range(N)], dtype="int64")
for i in range(N):
    arr[i, 2] = arr[i, 0] + arr[i, 1]
arr = arr[np.argsort(arr[:, 2])][::-1]
print((np.sum(arr[::2, 0]) - np.sum(arr[1::2, 1])))

+import sys +input = sys.stdin.readline