n = int(eval(input()))

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

ans = 0



for i in range(n):

    ans += a[i * 2 + 1]



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

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

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

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

-a = sorted(list(map(int, input().split())), reverse=True) -ans = 0 -for i in range(n): -    ans += a[i * 2 + 1] -print(ans) +a = sorted(map(int, input().split())) +print((sum(a[n::2])))