n = int(eval(input()))

ls = sorted(list(map(int, input().split())),reverse=True)



total = 0

res = 1

for i in range(n):

    total += ls[res]

    res += 2

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

l = sorted(list(map(int, input().split())),reverse=True)

print((sum(l[1:len(l)-n:2])))
n = int(eval(input()))
ls = sorted(list(map(int, input().split())), reverse=True)
total = 0
res = 1
for i in range(n):
    total += ls[res]
    res += 2
print(total)

n = int(eval(input()))
l = sorted(list(map(int, input().split())), reverse=True)
print((sum(l[1 : len(l) - n : 2])))

-ls = sorted(list(map(int, input().split())), reverse=True) -total = 0 -res = 1 -for i in range(n): -    total += ls[res] -    res += 2 -print(total) +l = sorted(list(map(int, input().split())), reverse=True) +print((sum(l[1 : len(l) - n : 2])))