import itertools

N = int(eval(input()))

D = list(input().split())

a = itertools.combinations(D,2)

sum= 0

for i,j in a:

    sum += eval("{} * {}".format(i,j))

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

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

print(((sum(D)**2-sum(list([x**2 for x in D])))//2))
import itertools

N = int(eval(input()))
D = list(input().split())
a = itertools.combinations(D, 2)
sum = 0
for i, j in a:
    sum += eval("{} * {}".format(i, j))
print(sum)

N = int(eval(input()))
D = list(map(int, input().split()))
print(((sum(D) ** 2 - sum(list([x**2 for x in D]))) // 2))

-import itertools - -D = list(input().split()) -a = itertools.combinations(D, 2) -sum = 0 -for i, j in a: -    sum += eval("{} * {}".format(i, j)) -print(sum) +D = list(map(int, input().split())) +print(((sum(D) ** 2 - sum(list([x**2 for x in D]))) // 2))