N = int(eval(input()))

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

from itertools import accumulate

print((sum(list(d*c for d, c in zip(D[1:], accumulate(D))))))

N = int(eval(input()))

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

from itertools import combinations

ans = 0

for i , j in combinations(D,2):

    ans += i*j

print(ans)
N = int(eval(input()))
D = list(map(int, input().split()))
from itertools import accumulate

print((sum(list(d * c for d, c in zip(D[1:], accumulate(D))))))

N = int(eval(input()))
D = list(map(int, input().split()))
from itertools import combinations

ans = 0
for i, j in combinations(D, 2):
    ans += i * j
print(ans)

-from itertools import accumulate +from itertools import combinations -print((sum(list(d * c for d, c in zip(D[1:], accumulate(D)))))) +ans = 0 +for i, j in combinations(D, 2): +    ans += i * j +print(ans)