N=int(eval(input()))

A=[0]*N

B=[0]*N

diff=[0]*N

for i in range(N):

  A[i],B[i]=list(map(int,input().split()))

  diff[i]=[A[i]+B[i],i]

  

diff=sorted(diff,key=lambda x:x[0])[::-1]

taka=0

aoki=0

for i in range(len(diff)):

  if i%2==0:

    taka+=A[diff[i][1]]

  else:

    aoki+=B[diff[i][1]]



print((taka-aoki))
import sys

readline = sys.stdin.readline



N = int(readline())

A = [0] * N

B = [0] * N

C = [0] * N

for i in range(N):

  A[i],B[i] = list(map(int,readline().split()))

  C[i] = (A[i] + B[i], i)

  

C = sorted(C, key = lambda x:x[0], reverse = True)



ans = 0

for i in range(len(C)):

  if i % 2 == 0:

    ans += A[C[i][1]]

  else:

    ans -= B[C[i][1]]

    

print(ans)
N = int(eval(input()))
A = [0] * N
B = [0] * N
diff = [0] * N
for i in range(N):
    A[i], B[i] = list(map(int, input().split()))
    diff[i] = [A[i] + B[i], i]
diff = sorted(diff, key=lambda x: x[0])[::-1]
taka = 0
aoki = 0
for i in range(len(diff)):
    if i % 2 == 0:
        taka += A[diff[i][1]]
    else:
        aoki += B[diff[i][1]]
print((taka - aoki))

import sys

readline = sys.stdin.readline
N = int(readline())
A = [0] * N
B = [0] * N
C = [0] * N
for i in range(N):
    A[i], B[i] = list(map(int, readline().split()))
    C[i] = (A[i] + B[i], i)
C = sorted(C, key=lambda x: x[0], reverse=True)
ans = 0
for i in range(len(C)):
    if i % 2 == 0:
        ans += A[C[i][1]]
    else:
        ans -= B[C[i][1]]
print(ans)

-N = int(eval(input())) +import sys + +readline = sys.stdin.readline +N = int(readline()) -diff = [0] * N +C = [0] * N -    A[i], B[i] = list(map(int, input().split())) -    diff[i] = [A[i] + B[i], i] -diff = sorted(diff, key=lambda x: x[0])[::-1] -taka = 0 -aoki = 0 -for i in range(len(diff)): +    A[i], B[i] = list(map(int, readline().split())) +    C[i] = (A[i] + B[i], i) +C = sorted(C, key=lambda x: x[0], reverse=True) +ans = 0 +for i in range(len(C)): -        taka += A[diff[i][1]] +        ans += A[C[i][1]] -        aoki += B[diff[i][1]] -print((taka - aoki)) +        ans -= B[C[i][1]] +print(ans)