# nikkei2019-qualC - Different Strokes

def main():

    N = int(eval(input()))

    A = sorted([tuple(map(int, input().split())) for _ in range(N)], key=sum, reverse=1)

    ans = sum(i for i, j in A[::2]) - sum(j for i, j in A[1::2])

    print(ans)





if __name__ == "__main__":

    main()
# nikkei2019-qualC - Different Strokes

def main():

    # player gets ai <-> point spread increases by ai + bi -> sort A by ai + bi

    # player gets Ai whose index is even / rival gets Ai whose index is odd

    N, *AB = list(map(int, open(0).read().split()))

    A = [(i, j) for i, j in zip(*[iter(AB)] * 2)]

    A.sort(key=sum, reverse=1)

    ans = sum(i for i, j in A[::2]) - sum(j for i, j in A[1::2])

    print(ans)





if __name__ == "__main__":

    main()
# nikkei2019-qualC - Different Strokes
def main():
    N = int(eval(input()))
    A = sorted([tuple(map(int, input().split())) for _ in range(N)], key=sum, reverse=1)
    ans = sum(i for i, j in A[::2]) - sum(j for i, j in A[1::2])
    print(ans)


if __name__ == "__main__":
    main()

# nikkei2019-qualC - Different Strokes
def main():
    # player gets ai <-> point spread increases by ai + bi -> sort A by ai + bi
    # player gets Ai whose index is even / rival gets Ai whose index is odd
    N, *AB = list(map(int, open(0).read().split()))
    A = [(i, j) for i, j in zip(*[iter(AB)] * 2)]
    A.sort(key=sum, reverse=1)
    ans = sum(i for i, j in A[::2]) - sum(j for i, j in A[1::2])
    print(ans)


if __name__ == "__main__":
    main()

-    N = int(eval(input())) -    A = sorted([tuple(map(int, input().split())) for _ in range(N)], key=sum, reverse=1) +    # player gets ai <-> point spread increases by ai + bi -> sort A by ai + bi +    # player gets Ai whose index is even / rival gets Ai whose index is odd +    N, *AB = list(map(int, open(0).read().split())) +    A = [(i, j) for i, j in zip(*[iter(AB)] * 2)] +    A.sort(key=sum, reverse=1)