n=int(eval(input()))

a=[int(i)for i in input().split()]

a.sort()

alice=0

bob=0

for i in range(n):

    if i%2==0:

        alice+=a.pop(-1)

    else:

        bob+=a.pop(-1)

print((alice-bob))
n=int(eval(input()))

a=sorted([int(i)for i in input().split()])

res=0

for i in range(n):

    tmp=a.pop(-1)

    if i%2==0:

        res+=tmp

    else:

        res-=tmp

print(res)
n = int(eval(input()))
a = [int(i) for i in input().split()]
a.sort()
alice = 0
bob = 0
for i in range(n):
    if i % 2 == 0:
        alice += a.pop(-1)
    else:
        bob += a.pop(-1)
print((alice - bob))

n = int(eval(input()))
a = sorted([int(i) for i in input().split()])
res = 0
for i in range(n):
    tmp = a.pop(-1)
    if i % 2 == 0:
        res += tmp
    else:
        res -= tmp
print(res)

-a = [int(i) for i in input().split()] -a.sort() -alice = 0 -bob = 0 +a = sorted([int(i) for i in input().split()]) +res = 0 +    tmp = a.pop(-1) -        alice += a.pop(-1) +        res += tmp -        bob += a.pop(-1) -print((alice - bob)) +        res -= tmp +print(res)