N = int(eval(input()))

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



sum_num = 0

for i in range(N):

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

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



print(sum_num)
from itertools import combinations



n = int(eval(input()))

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



C = list(combinations(D, 2))



ans = 0

for i, j in C:

  ans += i*j

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

from itertools import combinations

n = int(eval(input()))
D = list(map(int, input().split()))
C = list(combinations(D, 2))
ans = 0
for i, j in C:
    ans += i * j
print(ans)

-N = int(eval(input())) -d_list = list(map(int, input().split())) -sum_num = 0 -for i in range(N): -    for j in range(i + 1, N): -        sum_num += d_list[i] * d_list[j] -print(sum_num) +from itertools import combinations + +n = int(eval(input())) +D = list(map(int, input().split())) +C = list(combinations(D, 2)) +ans = 0 +for i, j in C: +    ans += i * j +print(ans)