n,*d=list(map(int,open(0).read().split()))

s=sum(d)**2

for v in d: s-=v**2

print(("%d"%(s/2)))
n,*d=list(map(int,open(0).read().split()))

s=sum(d)**2

for v in d:s-=v**2

print((s//2))
n, *d = list(map(int, open(0).read().split()))
s = sum(d) ** 2
for v in d:
    s -= v**2
print(("%d" % (s / 2)))

n, *d = list(map(int, open(0).read().split()))
s = sum(d) ** 2
for v in d:
    s -= v**2
print((s // 2))

-print(("%d" % (s / 2))) +print((s // 2))