import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

sys.setrecursionlimit(10 ** 7)



n = int(readline())

ab = [list(map(int, readline().split())) for i in range(n)]

memo = [0] * n

ans = 0

for i, ab_ in enumerate(ab):

    memo[i] = ab_[0] + ab_[1]

    ans -= ab_[1]

memo.sort(reverse=True)

for i in range(n):

    if i % 2 == 0:

        ans += memo[i]

print(ans)

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

sys.setrecursionlimit(10 ** 7)



n = int(readline())

ab = []

ans = 0

for _ in range(n):

    a, b = list(map(int, readline().split()))

    ab.append(a + b)

    ans -= b

ab.sort(reverse=True)

ans += sum(ab[::2])

print(ans)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n = int(readline())
ab = [list(map(int, readline().split())) for i in range(n)]
memo = [0] * n
ans = 0
for i, ab_ in enumerate(ab):
    memo[i] = ab_[0] + ab_[1]
    ans -= ab_[1]
memo.sort(reverse=True)
for i in range(n):
    if i % 2 == 0:
        ans += memo[i]
print(ans)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n = int(readline())
ab = []
ans = 0
for _ in range(n):
    a, b = list(map(int, readline().split()))
    ab.append(a + b)
    ans -= b
ab.sort(reverse=True)
ans += sum(ab[::2])
print(ans)

-ab = [list(map(int, readline().split())) for i in range(n)] -memo = [0] * n +ab = [] -for i, ab_ in enumerate(ab): -    memo[i] = ab_[0] + ab_[1] -    ans -= ab_[1] -memo.sort(reverse=True) -for i in range(n): -    if i % 2 == 0: -        ans += memo[i] +for _ in range(n): +    a, b = list(map(int, readline().split())) +    ab.append(a + b) +    ans -= b +ab.sort(reverse=True) +ans += sum(ab[::2])