import itertools

n=int(eval(input()))

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

combs=list(itertools.combinations(takoyaki,2))

recovery=list(c[0]*c[1] for c in combs)

print((sum(recovery)))
n=int(eval(input()))

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

tot=sum(d)**2

for i in range(n):

  tot-=d[i]**2

print((tot//2))

import itertools

n = int(eval(input()))
takoyaki = list(map(int, input().split()))
combs = list(itertools.combinations(takoyaki, 2))
recovery = list(c[0] * c[1] for c in combs)
print((sum(recovery)))

n = int(eval(input()))
d = list(map(int, input().split()))
tot = sum(d) ** 2
for i in range(n):
    tot -= d[i] ** 2
print((tot // 2))

-import itertools - -takoyaki = list(map(int, input().split())) -combs = list(itertools.combinations(takoyaki, 2)) -recovery = list(c[0] * c[1] for c in combs) -print((sum(recovery))) +d = list(map(int, input().split())) +tot = sum(d) ** 2 +for i in range(n): +    tot -= d[i] ** 2 +print((tot // 2))