import sys

stdin = sys.stdin

 

sys.setrecursionlimit(10**5) 

 

def li(): return list(map(int, stdin.readline().split()))

def li_(): return [int(x)-1 for x in stdin.readline().split()]

def lf(): return list(map(float, stdin.readline().split()))

def ls(): return stdin.readline().split()

def ns(): return stdin.readline().rstrip()

def lc(): return list(ns())

def ni(): return int(stdin.readline())

def nf(): return float(stdin.readline())



from heapq import heappush, heappop



n = ni()

ab = [tuple(li()) for _ in range(n)]



que = []

for ai, bi in ab:

    heappush(que, [-ai-bi, ai, bi])

    

cnt = 0

tak = 0

aok = 0

while que:

    sm, ai, bi = heappop(que)

    if cnt % 2 == 0:

        tak += ai

    else:

        aok += bi

        

    cnt += 1

        

print((tak-aok))
import sys

stdin = sys.stdin



sys.setrecursionlimit(10 ** 7)



def li(): return list(map(int, stdin.readline().split()))

def li_(): return [int(x) - 1 for x in stdin.readline().split()]

def lf(): return list(map(float, stdin.readline().split()))

def ls(): return stdin.readline().split()

def ns(): return stdin.readline().rstrip()

def lc(): return list(ns())

def ni(): return int(stdin.readline())

def nf(): return float(stdin.readline())



n = ni()

ab = [list(li()) for _ in range(n)]

ab.sort(key=lambda x: x[0] + x[1], reverse=True)



first = 0

second = 0



for i, (ai, bi) in enumerate(ab):

    if i%2 == 0:

        first += ai

    else:

        second += bi



print((first - second))
import sys

stdin = sys.stdin
sys.setrecursionlimit(10**5)


def li():
    return list(map(int, stdin.readline().split()))


def li_():
    return [int(x) - 1 for x in stdin.readline().split()]


def lf():
    return list(map(float, stdin.readline().split()))


def ls():
    return stdin.readline().split()


def ns():
    return stdin.readline().rstrip()


def lc():
    return list(ns())


def ni():
    return int(stdin.readline())


def nf():
    return float(stdin.readline())


from heapq import heappush, heappop

n = ni()
ab = [tuple(li()) for _ in range(n)]
que = []
for ai, bi in ab:
    heappush(que, [-ai - bi, ai, bi])
cnt = 0
tak = 0
aok = 0
while que:
    sm, ai, bi = heappop(que)
    if cnt % 2 == 0:
        tak += ai
    else:
        aok += bi
    cnt += 1
print((tak - aok))

import sys

stdin = sys.stdin
sys.setrecursionlimit(10**7)


def li():
    return list(map(int, stdin.readline().split()))


def li_():
    return [int(x) - 1 for x in stdin.readline().split()]


def lf():
    return list(map(float, stdin.readline().split()))


def ls():
    return stdin.readline().split()


def ns():
    return stdin.readline().rstrip()


def lc():
    return list(ns())


def ni():
    return int(stdin.readline())


def nf():
    return float(stdin.readline())


n = ni()
ab = [list(li()) for _ in range(n)]
ab.sort(key=lambda x: x[0] + x[1], reverse=True)
first = 0
second = 0
for i, (ai, bi) in enumerate(ab):
    if i % 2 == 0:
        first += ai
    else:
        second += bi
print((first - second))

-sys.setrecursionlimit(10**5) +sys.setrecursionlimit(10**7) -from heapq import heappush, heappop - -ab = [tuple(li()) for _ in range(n)] -que = [] -for ai, bi in ab: -    heappush(que, [-ai - bi, ai, bi]) -cnt = 0 -tak = 0 -aok = 0 -while que: -    sm, ai, bi = heappop(que) -    if cnt % 2 == 0: -        tak += ai +ab = [list(li()) for _ in range(n)] +ab.sort(key=lambda x: x[0] + x[1], reverse=True) +first = 0 +second = 0 +for i, (ai, bi) in enumerate(ab): +    if i % 2 == 0: +        first += ai -        aok += bi -    cnt += 1 -print((tak - aok)) +        second += bi +print((first - second))