import itertools

N=int(eval(input()))

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

comb = list(itertools.combinations(d_list, 2))

sum_heal = 0

for i,j in comb:

    sum_heal += i*j

print(sum_heal)
N=int(eval(input()))

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

sum_heal = 0 

for i in range(N):

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

        sum_heal += d_list[i]*d_list[j]

print(sum_heal)
import itertools

N = int(eval(input()))
d_list = [int(i) for i in input().split()]
comb = list(itertools.combinations(d_list, 2))
sum_heal = 0
for i, j in comb:
    sum_heal += i * j
print(sum_heal)

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

-import itertools - -comb = list(itertools.combinations(d_list, 2)) -for i, j in comb: -    sum_heal += i * j +for i in range(N): +    for j in range(i + 1, N): +        sum_heal += d_list[i] * d_list[j]