It's now the season of TAKOYAKI FESTIVAL!
This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The deliciousness of the i-th takoyaki is d_i.
As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.
There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.

-----Constraints-----
 - All values in input are integers.
 - 2 \leq N \leq 50
 - 0 \leq d_i \leq 100

-----Input-----
Input is given from Standard Input in the following format:
N
d_1 d_2 ... d_N

-----Output-----
Print the sum of the health points restored from eating two takoyaki over all possible choices of two takoyaki from the N takoyaki served.

-----Sample Input-----
3
3 1 2

-----Sample Output-----
11

There are three possible choices:
 - Eat the first and second takoyaki. You will restore 3 health points.
 - Eat the second and third takoyaki. You will restore 2 health points.
 - Eat the first and third takoyaki. You will restore 6 health points.
The sum of these values is 11.

Difficulty: EASY

Solutions:
n = int(input())
d = [int(di) for di in input().split()]
print(sum((d[i] * d[j] for i in range(n) for j in range(i + 1, n))))


n = int(input())
d = list(map(int, input().split()))
ans = 0
for i in range(len(d) - 1):
	for k in range(i + 1, len(d)):
		ans += d[i] * d[k]
print(ans)


n = int(input())
l = [int(i) for i in input().split()]
s = 0
for i in range(n):
	for j in range(i + 1, n):
		s += l[j] * l[i]
print(s)


N = int(input())
A = list(map(int, input().split()))
s = sum(A) ** 2
for i in range(N):
	s -= A[i] ** 2
print(int(s / 2))


import itertools as itr
n = input()
d = map(int, input().split())
k = itr.combinations(d, 2)
sum_k = sum([a * b for (a, b) in k])
print(sum_k)


from itertools import permutations
n = int(input())
d = [int(i) for i in input().split()]
t = sum([i[0] * i[1] for i in permutations(d, 2)]) // 2
print(t)


(n, *d) = map(int, open(0).read().split())
print(sum((d[i] * d[j] for i in range(n) for j in range(i + 1, n))))


n = int(input())
s = input().split()
c = 0
d = 0
for num in s:
	c += int(num)
	d += int(num) ** 2
e = (c ** 2 - d) // 2
print(e)


n = int(input())
d = list(map(int, input().split()))
dd = [x ** 2 for x in d]
print((sum(d) ** 2 - sum(dd)) // 2)


n = int(input())
lst = list(map(int, input().split()))
x = 0
for i in range(n):
	x += lst[i] * sum(lst[i + 1:n])
print(x)


n = int(input())
a = [*map(int, input().split())]
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		ans += a[i] * a[j]
print(ans)


N = int(input())
D = list(map(int, input().split()))
a = 0
b = 0
for i in range(N):
	a += D[i] ** 2
	b += D[i]
print((b ** 2 - a) // 2)


a = int(input())
b = list(map(int, input().split()))
s = 0
for i in range(a):
	for j in range(i + 1, a):
		s += b[i] * b[j]
print(s)


n = int(input())
d = list(map(int, input().split()))
d2 = [m ** 2 for m in d]
print((sum(d) ** 2 - sum(d2)) // 2)


N = int(input())
dlst = list(map(int, input().split()))
ans = 0
for i in range(len(dlst) - 1):
	k = dlst.pop()
	ans = ans + k * sum(dlst)
print(ans)


n = int(input())
d = list(map(int, input().split()))
ans = sum(d) ** 2
for i in d:
	ans -= i ** 2
print(ans // 2)


input()
A = list(map(int, input().split()))
b = 0
while A:
	a = A.pop(0)
	for i in A:
		b += i * a
print(b)


import itertools
n = int(input())
l = list(map(int, input().split()))
c = itertools.combinations(l, 2)
ans = sum((x * y for (x, y) in c))
print(ans)


n = int(input())
d = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		ans += d[i] * d[j]
print(ans)


a = int(input())
b = [int(i) for i in input().split()]
ans = 0
for i in range(a):
	ans += b[i] * (sum(b) - b[i])
print(ans // 2)


n = int(input())
m = list(map(int, input().split()))
m2 = []
for j in m:
	m2.append(j * j)
print(int((sum(m) ** 2 - sum(m2)) / 2))


n = int(input())
a = list(map(int, input().split()))
print(sum([a[i] * a[j] for i in range(n) for j in range(i + 1, n)]))


import itertools
N = int(input())
d = list(map(int, input().split()))
c = [x * y for (x, y) in itertools.combinations(d, 2)]
print(sum(c))


def main():
	from itertools import combinations
	_ = int(input())
	d = [int(x) for x in input().split()]
	print(sum([a * b for (a, b) in combinations(d, 2)]))

def __starting_point():
	main()
__starting_point()


n = int(input())
b = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
	ans += b[i] * sum(b[i + 1:])
print(ans)


i = input
n = int(i())
l = [int(_) for _ in i().split()]
ans = 0
for _ in range(n):
	ans += l[_] * sum(l[_ + 1:])
print(ans)


import itertools as it
N = int(input())
d = list(map(int, input().split()))
k = list(it.combinations(d, 2))
n = [a * b for (a, b) in k]
print(sum(n))


n = int(input())
d = list(map(int, input().split()))
p = sum(d)
r = 0
for i in range(n):
	r += (p - d[i]) * d[i]
print(r // 2)


t = input()
d = list(map(int, input().split()))
cure = 0
for i in range(len(d)):
	for s in range(i + 1, len(d)):
		cure += d[i] * d[s]
print(cure)


N = int(input())
d = list(map(int, input().split()))
print((sum(d) ** 2 - sum(map(lambda x: x ** 2, d))) // 2)


N = int(input())
d = list(map(int, input().split()))
s = sum(d)
ans = s ** 2
for i in range(N):
	ans -= d[i] ** 2
print(ans // 2)


n = int(input())
d = list(map(int, input().split()))
print((sum(d) ** 2 - sum(map(lambda x: x ** 2, d))) // 2)


N = int(input())
A = [int(a) for a in input().split()]
print((sum(A) ** 2 - sum([a ** 2 for a in A])) // 2)


n = int(input())
l = list(map(int, input().split()))
(s, res) = (l[0], 0)
for i in range(1, n):
	res += s * l[i]
	s += l[i]
print(res)


N = int(input())
D = list(map(int, input().split()))
c = 0
for i in range(N):
	c += D[i] * (sum(D) - D[i]) / 2
print(int(c))


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


b = input()
a = list(map(int, input().split()))
s = sum(a)
an = 0
for i in a:
	an += (s - i) * i
print(an >> 1)


n = int(input())
d = list(map(int, input().split()))
s = 0
for i in range(n):
	for j in range(n):
		if i < j:
			s += d[i] * d[j]
print(s)


a = int(input())
b = list(map(int, input().split()))
c = sum(b)
d = [(c - x) * x for x in b]
e = sum(d)
print(int(e / 2))


n = int(input())
d = [int(i) for i in input().split()]
d1 = [i ** 2 for i in d]
s = sum(d)
ans = (s ** 2 - sum(d1)) // 2
print(ans)


a = int(input())
b = 0
c = list(map(int, input().split()))
for i in range(a):
	for k in range(a):
		b = b + c[i] * c[k]
for u in range(a):
	b = b - c[u] * c[u]
print(int(b / 2))


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
s1 = s * s
t = 0
for i in l:
	t += i * i
print((s1 - t) // 2)


(N, *D) = map(int, open(0).read().split())
s = 0
ans = 0
for i in range(1, len(D)):
	s += D[i - 1]
	ans += D[i] * s
print(ans)


from itertools import combinations as cmb
import numpy as np
N = int(input())
d = list(map(int, input().split()))
(x, y) = np.array(list(cmb(d, 2))).T
print(np.sum(x * y))


from itertools import combinations
n = int(input())
d = list(map(int, input().split()))
c = combinations(d, 2)
sumd = 0
for (x, y) in c:
	sumd += x * y
print(sumd)


n = int(input())
cur = res = 0
for e in map(int, input().split()):
	res += e * cur
	cur += e
print(res)


from itertools import combinations
n = int(input())
d = list(map(int, input().split()))
comb = combinations(d, 2)
res = 0
for (x, y) in comb:
	res += x * y
print(res)


n = int(input())
l = list(map(int, input().split()))
print(sum((l[i] * l[j] for i in range(n) for j in range(i))))


(N, *D) = map(int, open(0).read().split())
import itertools
print(sum((a * b for (a, b) in itertools.combinations(D, 2))))


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
ans = 0
for i in l:
	ans += (s - i) * i
print(ans // 2)


N = int(input())
d = list(map(int, input().split()))
t = 0
for i in range(N - 1):
	for k in range(i + 1, N):
		t += d[i] * d[k]
print(t)


n = int(input())
list = list(map(int, input().split()))
s = 0
for i in range(0, n - 1):
	s += list[i] * sum(list[i + 1:n])
print(s)


from itertools import *
input()
print(sum([n * m for (n, m) in combinations(map(int, input().split()), 2)]))


import itertools
n = int(input())
Tako = list(map(int, input().split()))
ans = 0
for (x, y) in itertools.combinations(Tako, 2):
	ans += x * y
print(ans)


a = int(input())
b = list(map(int, input().split()))
c = 0
for i in range(a):
	for j in range(i):
		c += b[i] * b[j]
print(c)


N = int(input())
A = list(map(int, input().split()))
p = sum(A)
q = sum([a * a for a in A])
print((p * p - q) // 2)


input()
l = list(map(int, input().split()))
a = 0
for _ in l:
	a += _ * (sum(l) - _)
print(a // 2)


N = int(input())
d = list(map(int, input().split()))
ret = 0
for di in d:
	ret += di * sum(d) - di ** 2
print(ret // 2)


N = int(input())
O = list(map(int, input().split()))
t = 0
for i in range(N):
	for j in range(i):
		t += O[i] * O[j]
print(t)


N = int(input())
d = list(map(int, input().split()))
print(sum((d[x] * d[y] for x in range(N) for y in range(x, N) if x != y)))


n = int(input())
D = list(map(int, input().split()))
A = sum(D)
ans = 0
for d in D:
	A -= d
	ans += A * d
print(ans)


n = int(input())
a = list(map(int, input().split()))
p = sum(a)
q = sum([x * x for x in a])
print((p * p - q) // 2)


N = int(input())
b = list(map(int, input().split()))
c = []
for i in range(N):
	c.append(b[i] ** 2)
print((sum(b) ** 2 - sum(c)) // 2)


n = int(input())
oisi = list(map(int, input().split()))
total = 0
for i in range(0, n - 1):
	for j in range(i + 1, n):
		total += oisi[i] * oisi[j]
print(total)


n = int(input())
l = list(map(int, input().split()))
s = 0
for (i, j) in enumerate(l):
	for k in l[i + 1:]:
		s += j * k
print(s)


N = int(input())
A = list(map(int, input().split()))
B = sum(A)
count = 0
for i in range(N):
	count += A[i] ** 2
print((B ** 2 - count) // 2)


import itertools
N = int(input())
d = list(map(int, input().split()))
lst = list(itertools.combinations(d, 2))
total = 0
for n in lst:
	c = n[0] * n[1]
	total += c
print(total)


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(500000)
INF = float('inf')
(YES, Yes, yes, NO, No, no) = ('YES', 'Yes', 'yes', 'NO', 'No', 'no')
(dy4, dx4) = ([0, 1, 0, -1], [1, 0, -1, 0])
(dy8, dx8) = ([0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1])

def inside(y, x, H, W):
	return 0 <= y < H and 0 <= x < W

def ceil(a, b):
	return (a + b - 1) // b

def sum_of_arithmetic_progression(s, d, n):
	return n * (2 * s + (n - 1) * d) // 2

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	g = gcd(a, b)
	return a / g * b

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

def main():
	solve()

def __starting_point():
	main()
__starting_point()


n = int(input())
lis = list(map(int, input().split()))
ans = 0
for i in range(0, n - 1):
	for t in range(i + 1, n):
		con = lis[i] * lis[t]
		ans += con
print(ans)


n = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(n):
	for j in range(i):
		ans += A[i] * A[j]
print(ans)


n = int(input())
a = list(map(int, input().split()))
p = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		p += a[i] * a[j]
print(p)


n = int(input())
d = list(map(int, input().split()))
a = 0
for i in range(n):
	for j in range(n):
		if i != j:
			a += d[i] * d[j]
print(a // 2)


n = int(input())
a = [int(x) for x in input().split()]
res = 0
for i in range(n):
	for j in range(i + 1, n):
		res += a[i] * a[j]
print(res)


(N, *D) = map(int, open(0).read().split())
i = 0
A = 0
while i < N:
	j = i + 1
	while j < N:
		A += D[i] * D[j]
		j += 1
	i += 1
print(A)


n = int(input())
a = list(map(int, input().split()))
sqsum = sum((i * i for i in a))
ans = (sum(a) * sum(a) - sqsum) // 2
print(ans)


input()
(*l,) = map(int, input().split())
print((pow(sum(l), 2) - sum([pow(x, 2) for x in l])) // 2)


n = int(input())
d = list(map(int, input().split()))
a = sum(d) ** 2
b = sum((d[i] ** 2 for i in range(n)))
print((a - b) // 2)


(n, *a) = map(int, open(0).read().split())
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		ans += a[i] * a[j]
print(ans)


N = int(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(input())
d = list(map(int, input().split(' ')))
s = 0
s2 = 0
for x in d:
	s += x
	s2 += x * x
print((s * s - s2) // 2)


n = int(input())
l = list(map(int, input().split()))
su = 0
for i in l:
	su += i * sum(l) - i * i
print(int(su / 2))


n = int(input())
A = list(map(int, input().split()))
f = 0
for i in range(0, n - 1):
	for j in range(i + 1, n):
		f = f + A[i] * A[j]
print(f)


from itertools import combinations
from typing import List

def answer(n: int, d: List[int]) -> int:
	return sum((d[x] * d[y] for (x, y) in combinations(list(range(n)), 2)))

def main():
	n = int(input())
	d = list(map(int, input().split()))
	print(answer(n, d))

def __starting_point():
	main()
__starting_point()


N = int(input())
data = [int(x) for x in input().split()]
data2 = [x ** 2 for x in data]
print((sum(data) ** 2 - sum(data2)) // 2)


from itertools import combinations
input()
d = list(map(int, input().split()))
comb = combinations(d, 2)
dsum = 0
for (a, b) in comb:
	dsum += a * b
print(dsum)


n = int(input())
l = list(map(int, input().split()))
print(sum((l[i] * x for i in range(len(l) - 1) for x in l[i + 1:])))


n = int(input())
l = [int(i) for i in input().split()]
s = sum(l)
ss = s * s
sq = sum((i * i for i in l))
print((ss - sq) // 2)


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


N = int(input())
D = [int(_) for _ in input().split()]
S = sum(D)
W = [(S - d) * d for d in D]
print(sum(W) // 2)


gomi = input()
tako = [int(i) for i in input().split()]
print(int((sum(tako) ** 2 - sum([i ** 2 for i in tako])) / 2))


N = int(input())
d = list(map(int, input().split()))
sum1 = sum(d) ** 2
sum2 = sum([i * i for i in d])
print(int((sum1 - sum2) / 2))


N = int(input())
d_s = list(map(int, input().split()))
S = sum(d_s)
print(sum(list(map(lambda x: (S - x) * x, d_s))) // 2)


N = int(input())
D = list(map(int, input().split()))
p = 0
q = 0
for i in range(N):
	p = p + D[i] ** 2
	q = q + D[i]
print((q ** 2 - p) // 2)


import itertools
print(sum([i * j for (i, j) in itertools.combinations([int(i) for i in (input(), input())[1].split()], 2)]))


(_, d) = open(0)
(*d,) = map(int, d.split())
print(sum(d) ** 2 - sum((i ** 2 for i in d)) >> 1)


input()
s = t = 0
for i in map(int, input().split()):
	s += i * i
	t += i
print(t * t - s >> 1)


n = int(input())
t = [int(x) for x in input().split()]
t2 = [x * x for x in t]
print((sum(t) ** 2 - sum(t2)) // 2)


import itertools

def resolve():
	n = int(input())
	d = tuple(map(int, input().split()))
	ans = 0
	for a in itertools.combinations(d, 2):
		ans += a[0] * a[1]
	print(ans)
resolve()


n = int(input())
d = list(map(int, input().split()))
sum1 = sum(d)
sum2 = 0
for i in d:
	sum2 += i ** 2
print((sum1 ** 2 - sum2) // 2)


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


N = int(input())
L = list(map(int, input().split()))
a = 0
for i in L:
	a = a + i ** 2
b = sum(L)
print((b ** 2 - a) // 2)


n = int(input())
d = list(map(int, input().split()))
r = 0
for i in range(n - 1):
	r += d[i] * sum(d[i + 1:])
print(r)


n = int(input())
arr = list(map(int, input().split()))
ans = 0
tmp = sum(arr)
for val in arr:
	ans += val * (tmp - val)
print(ans // 2)


import itertools
N = int(input())
D = list(map(int, input().split()))
takocombi = list(itertools.combinations([i for i in range(N)], 2))
ans = 0
for h in range(len(takocombi)):
	ans += D[takocombi[h][0]] * D[takocombi[h][1]]
print(ans)


n = int(input())
d = list(map(int, input().split()))
d2 = d[:]
total = 0
for i in range(len(d)):
	for j in range(i, len(d2)):
		if i != j:
			total += d[i] * d[j]
print(total)


N = int(input())
D = list(map(int, input().split()))
ans = 0
for i in range(N):
	tako1 = D[i]
	for j in range(0, i):
		tako2 = D[j]
		ans += tako1 * tako2
	for j in range(i + 1, N):
		tako2 = D[j]
		ans += tako1 * tako2
print(ans // 2)


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


N = int(input())
d = list(map(int, input().split()))
sumd = sum(d)
d_2 = sum([i * i for i in d])
print((sumd * sumd - d_2) // 2)