N=int(eval(input()))

d=[int(i) for i in input().split()]

ans=0

for i in range(N):

  for j in range(i+1,N):

    ans+=d[i]*d[j]

print(ans)

N=int(eval(input()))

d=[int(i) for i in input().split()]

X=sum([i*i for i in d])

print(((sum(d)**2-X)//2))

N = int(eval(input()))
d = [int(i) for i in input().split()]
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        ans += d[i] * d[j]
print(ans)

N = int(eval(input()))
d = [int(i) for i in input().split()]
X = sum([i * i for i in d])
print(((sum(d) ** 2 - X) // 2))

-ans = 0 -for i in range(N): -    for j in range(i + 1, N): -        ans += d[i] * d[j] -print(ans) +X = sum([i * i for i in d]) +print(((sum(d) ** 2 - X) // 2))