n=sorted([int(eval(input())) for _ in range(int(eval(input())))],reverse=True);print((max(n)//2+sum(n[1:])))
n=sorted([int(eval(input())) for _ in range(int(eval(input())))],reverse=True);print((sum(n)-max(n)//2))
n = sorted([int(eval(input())) for _ in range(int(eval(input())))], reverse=True)
print((max(n) // 2 + sum(n[1:])))

n = sorted([int(eval(input())) for _ in range(int(eval(input())))], reverse=True)
print((sum(n) - max(n) // 2))

-print((max(n) // 2 + sum(n[1:]))) +print((sum(n) - max(n) // 2))