n=int(eval(input()))

a=list(map(int,input().split()))

a.sort()

a.reverse()

total=0

for i in range(n):

    total+=a[i*2+1]

print(total)
n=int(eval(input()))

a=list(map(int,input().split()))

a.sort()

print((sum(a[n::2])))
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
a.reverse()
total = 0
for i in range(n):
    total += a[i * 2 + 1]
print(total)

n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
print((sum(a[n::2])))

-a.reverse() -total = 0 -for i in range(n): -    total += a[i * 2 + 1] -print(total) +print((sum(a[n::2])))