Problem:
 Score : 200 points    Problem Statement 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 1 3
3 1 2      Sample Output 1 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 .       Sample Input 2 7
5 0 7 8 3 3 2      Sample Output 2 312

Solution (Python):





import sys

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n = int(input())
    d = list(map(int,ipti().split()))
    ans = 0

    for i in range(n-1):
        for j in range(i+1, n):
           ans += d[i] * d[j]

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
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)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
c = 0
for i1, j1 in enumerate(d):
    for i2, j2 in enumerate(d):
        if i1 == i2:
            continue
        else:
            c += j1 * j2
print(c // 2)

Solution (Python):
import sys

from collections import deque

def input():
    return sys.stdin.readline().rstrip('\n')

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

D = deque(D)
sum0 = D.pop()
hp = 0

for _ in range(N-1):
    d = D.pop()
    hp += d * sum0
    sum0 += d

print(hp)

Solution (Python):
import itertools
n = int(input())
d = list(map(int, input().split()))

print(sum([i[0] * i[1] for i in list(itertools.combinations(d, 2))]))

Solution (Python):
from itertools import combinations

num = int(input())
num_list = list(map(int,input().split()))
matrix = list(combinations(num_list,2))

sum = 0

for i in range(0,len(matrix)):
  sum = sum + matrix[i][0]*matrix[i][1]

print(sum)

Solution (Python):
N = int(input())
D = list(map(int,input().split()))
output = 0
for i in range(0,N):
    for j in range(i,N):
        if i!=j:
            output += D[i]*D[j]
print(output)

Solution (Python):
N=int(input())
D=list(map(int,input().split()))
print((sum(D)**2-sum(d*d for d in D))//2)

Solution (Python):
import itertools
N=int(input())
D=list(map(int,input().split()))
print((sum(D)**2-sum(d*d for d in D))//2)

Solution (Python):
import itertools
N=int(input())
D=list(map(int,input().split()))
print(sum(d*cumulate for d,cumulate in zip(D[1:],itertools.accumulate(D))))

Solution (Python):
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+1,N)))

Solution (Python):
n = int(input())
d = [int(x) for x in input().split()]
s = sum(d)
ans = 0
for i in range(n):
    ans += d[i]*(s-d[i])
print(ans//2)

Solution (Python):
N = int(input())
d = list(map(int, input().split(' ')))
total = 0
for i in range(N):
    for j in range(i+1, N):
        total += (d[i] * d[j])
print(total)

Solution (Python):



def main():
  n = int(input())
  Ds = list(map(int, input().strip().split()))
  ans = 0
  for i in range(n):
    for j in range(i+1, n):
      ans += Ds[i] * Ds[j]
  print(ans)
  
  
if __name__=='__main__':
  main()

Solution (Python):


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

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())

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

sq_summation = 0
summation = 0

for e in l:
    sq_summation += e**2
    summation += e

print(int((summation ** 2 - sq_summation) / 2))

Solution (Python):
n = int(input())
v = list(map(int, input().split()))

s = 0
for i, x in enumerate(v[:n-1]):
  for j, y in enumerate(v[i+1:]):
    s += y*x
    
print(s)

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

Solution (Python):
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)

Solution (Python):


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

Solution (Python):
n = int(input())
D = list(map(int,input().split()))

ans = 0

for i in range(n):
  for j in range(i):
    ans += D[i]*D[j]
print(ans)

Solution (Python):
N = int(input())

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


count = 0

for i in range(N): 
  for j in range(i):
    B = d[i] * d[j]
    count = count + B
    
print(count)

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

Solution (Python):
N = int(input())
takoyaki_list = list(map(int,input().split()))
total = 0 
listA = []
for i in range(N):
    for j in range(N-1):
        if i == j:
            pass
        else:
            A = [i,j]
            A.sort()
            listA.append(A)
listA = list(map(list, set(map(tuple, listA))))
for i,j in listA:
    A,B = [takoyaki_list[i],takoyaki_list[j]]
    total += A * B
print(total)

Solution (Python):
N=int(input())
D=list(map(int,input().split()))
S = 0



for i in range(N):
    for j in range(i, N-1):
        S = S + D[i] * D[j+1]

print(S)

Solution (Python):
from itertools import product
n = int(input())
a = list(map(int, input().split()))

s = sum(x*y for x,y in product(a,a))
t = sum(x*x for x in a)

print((s - t)//2)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
count=0
for i in range(N):
    for j in range(i):
        B=A[i]*A[j]
        count=count+B
print(count)

Solution (Python):
N = int(input())
dlist = list(map(int, input().split()))
A = sum(dlist) ** 2 // 2
B = sum([i ** 2 for i in dlist]) // 2

print(A - B)

Solution (Python):
N = int(input())
d = list(map(int,input().split()))

res = 0
for i in range(N):
    for j in range(i+1,N):
        res += d[i]*d[j]

print(res)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
h = len(d)

res = 0
for i in range(h):
    for j in range(i+1,h):
        res += d[i]*d[j]
print(res)

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

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
d = [int(x) for x in input().split()]

ans = 0

for i in range(N) :
    for j in range(N-i-1) :
        ans += d[i] * d[N-j-1]

print(ans)

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

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
sq = list(d[i]**2 for i in range(n))
ans = -sum(sq)
for i in range(n):
    for j in range(n):
        ans += d[i] * d[j]
print(int(ans/2))

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

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

sum_all = 0
for i in range(N):
  for s in range(i+1, N):
    sum_all += D[i] * D[s]
    
print(sum_all)

Solution (Python):
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)

Solution (Python):
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))

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

Solution (Python):
from itertools import combinations

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

r = sum([x * y for x, y in combinations(D, 2)])
print(r)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

cure = 0
for i in range(n-1):
  for j in range(i+1,n):
    cure += (d[i] * d[j])
print(cure)

Solution (Python):
n = int(input())
d = tuple(map(int,input().split()))
sum = 0
for i in range(0,n):
  for j in range(i+1,n):
    sum += d[i]*d[j]
print(sum)

Solution (Python):
N = int(input())
input_list = list(map(int, input().split()))



sum = 0
for i in range(N - 1):
    for j in range(i+1, N):
        sum += input_list[i] * input_list[j]

print(sum)

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

Solution (Python):
N = int(input())
D = [int(d) for d in input().split()]

SUM_D = sum(D)
xy = 0
xx = 0
for d in D:
    xy += d * SUM_D
    xx += d * d

print((xy - xx)//2)

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

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

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

Solution (Python):
import itertools
N=int(input())
d=list(map(int,input().split()))
total=0
nlis=[i for i in range(1,N+1)]
com=list(itertools.combinations(nlis,2))


for j in range(len(com)):
  total+=d[com[j][0]-1]*d[com[j][1]-1]
print(total)

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

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

ans = 0
for i in range(n):
    for j in range(i):
        ans += d[i] * d[j]

print(ans)

Solution (Python):
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)

Solution (Python):
import itertools
N = int(input())
D = [int(d) for d in input().split()]

l = list(itertools.combinations(D, 2))
sum = 0
for nums in l:
    sum += nums[0]*nums[1]

print(sum)

Solution (Python):
import itertools

n = int(input())
tako = list(map(int, input().split()))
comb = list(itertools.combinations(tako, 2))
ans = 0
for i in comb:
    ans += i[0] * i[1]

print(ans)

Solution (Python):
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)

Solution (Python):

from itertools import combinations
def main():
    n = int(input())
    d = [int(i) for i in input().split()]
    sum = 0 
    for i in combinations(d, 2):
        sum += i[0]*i[1]
    print(sum)
main()

Solution (Python):
from itertools import combinations
n = int(input())
d = list(map(int, input().split()))

heal = list(combinations(range(n), 2))

sums = 0
for i in heal:
    sums += d[i[0]] * d[i[1]]

print(sums)

Solution (Python):
import itertools

N = int(input())
d = list(map(int, input().split()))

comb = itertools.combinations(d, 2)

comb = [item[0]*item[1] for item in comb]

print(sum(comb))

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

print(sum([d[i]*d[j] for i in range(n) for j in range(i+1, n)]))

Solution (Python):
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)

Solution (Python):
N = int(input())
d = list(map(int,input().split()))

s = 0
for i in range (N):
    for j in range (i+1,N):
        s = s + d[i] * d[j]

print(s)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

Sum = 0
for i in range(N):
    for j in range(N):
        if i!=j:
            Sum += d[i] * d[j]

print(int(Sum/2))

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

Sum = 0
for i in range(N):
    for j in range(N):
        Sum += d[i] * d[j]

for i in range(N):
    Sum -= d[i] * d[i]

Sum = int(Sum/2)
print(Sum)

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

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

Solution (Python):



import itertools
n = int(input())
d = [int(x) for x in input().split()]
print(sum([a1 * a2 for a1, a2 in list(itertools.combinations(d, 2))]))

Solution (Python):
N = int(input())
d = list(map(int,input().split()))

R = 0
for i in range(N-1):
    for j in range(i+1, N):
        rec = d[i] * d[j]
        R += rec

print(R)

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

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

Solution (Python):
N=int(input())

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




answer=0

for i in range(1,N+1):
    for j in range(i+1,N+1):
        if i==j:
            nothing=0
        else:
            answer+=mylist[i-1]*mylist[j-1]
            
print(answer)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))

kotae=0
for i in range(n):
  for j in range(i+1,n):
    kotae=kotae+d[i]*d[j]
print(kotae)

Solution (Python):
N,*D = map(int,open(0).read().split())
print((sum(D)**2-sum(d*d for d in D))//2)

Solution (Python):
import itertools

n = int(input())
d = list(map(int,input().split()))

all = list(itertools.permutations(d,2))

ans = 0
for i in range(len(all)):
    ans += all[i][0]*all[i][1]

print(int(ans/2))

Solution (Python):
N = int(input())
List = list(map(int, input().split()))
Result = []
for i in range(N):
  for j in range(i+1, N):
    Result.append(List[i] * List[j])
print(sum(Result))

Solution (Python):



import itertools


def main():
    N = int(input())
    D = list(map(int, input().split()))
    result = 0
    comb = list(itertools.combinations(D, 2))
    for a, b in comb:
        result += a * b
    print(result)


if __name__ == "__main__":
    main()

Solution (Python):
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)

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

print(a)

Solution (Python):
N=int(input())
d=list(map(int,input().split()))
s=0
t=0
for i in range (N):
  for j in range(N):
    if i!=j:
      s+=d[i]*d[j]
u=int(s/2)
print(u)

Solution (Python):
import itertools
N=int(input())
tako_list=list(map(int,input().split()))
sum=0
for v in itertools.combinations(tako_list,2):
    sum+=v[0]*v[1]
print(sum)

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

Solution (Python):
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)

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

Solution (Python):
N = int(input())
D = input().split()
D = [int(d) for d in D]

import itertools

C = list(itertools.combinations(D,2))

ans =0
for c in C:
  ans += c[0]*c[1]
  
print(ans)

Solution (Python):
N=int(input())
d=list(map(int,input().split()))
S=sum(d)
S_2=S**2
d_2 = [i**2 for i in d]
S_3=sum(d_2)
print(int((S_2-S_3)/2))

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

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

recover = 0
for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        recover += d[i] * d[j]
print(recover)

Solution (Python):
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)

Solution (Python):
from itertools import permutations,combinations

N = int(input())
d = list(map(int,input().split()))

ans = 0

for item in list(combinations(d,2)):
    ans += item[0]*item[1]
    
print(ans)

Solution (Python):
def main(n,d):
    sumVal = 0
    for i in range(n-1):
        for j in range(i+1, n):
            sumVal += d[i]*d[j]
    return sumVal

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

Solution (Python):
n = int(input())
arrd = list(map(int,input().split()))
import itertools 
num = 0
for i in itertools.combinations(arrd,2):
    num += i[0] * i[1]
print(num)

Solution (Python):
n = int(input())
arrd = list(map(int,input().split()))
import itertools 
num = 0
for i in itertools.permutations(arrd,2):
    num += i[0] * i[1]
print(num//2)

Solution (Python):
import itertools
n = int(input())
l = list(map(int, input().split()))
sum = 0

for i,j in itertools.combinations(l,2):
  sum += i*j

print(sum)

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

ans = 0
for i, d1 in enumerate(D):
    for d2 in D[i+1:]:
        ans += d1 * d2
print(ans)

Solution (Python):
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)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
square_sum = 0
sum = 0
for j in range(n):
	square_sum += d[j] * d[j]
	sum += d[j]
print((sum * sum - square_sum) // 2)

Solution (Python):
n = int(input())
di = list(map(int, input().split()))


ans = 0
for i in range(n):
    for j in range(i+1, n):
        ans += di[i]*di[j]

print(ans)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
x=0

for i in range(n-1):
  for j in range(i+1,n):
    x = x+d[i]*d[j]

print(x)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

ans = 0
for i in range(n):
  ans += d[i]*sum(d[i+1:])
  
print(ans)

Solution (Python):
n = int(input())
dl = list(map(int, input().split()))

ans = 0
for i in range(n - 1):
    for j in range(i+1, n):
       ans += dl[i] * dl[j]

print(ans)

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

d_sum = 0
for i in range(N):
    for j in range(i+1, N):
        d_sum += D[i]*D[j]
print(d_sum)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
ans = []

for i in range(n-1):
    for j in range((n-1)-i):
        ans.append(d[i]*d[i+j+1])

print(sum(ans))

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

print(ans)

Solution (Python):
n=int(input())
dl=list(map(int,input().split()))

ans=0

for i in range(n):
    for j in range(n):
        if j <i:
            ans+=dl[i]*dl[j]
print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	N = II()
	d = LI()

	ans = 0
	for i in range(N-1):
		for j in range(i+1,N):
			ans += (d[i]*d[j])
	print(ans)


main()

Solution (Python):
import itertools


def x(L):
    return L[0] * L[1]


n = int(input())
d = map(int, input().split())

l = list(itertools.combinations(d, 2))

ans = 0
for i in l:
    ans += x(i)

print(ans)

Solution (Python):
import itertools

n = int(input())
d = map(int, input().split())

l = list(itertools.combinations(d, 2))

ans = 0
for i in range(len(l)):
    ans += l[i][0] * l[i][1]

print(ans)

Solution (Python):
import itertools
n = int(input())
d = [int(i) for i in input().split()]
ans = []

for i in range(n):
    for j in range(i+1,n):
        ans.append(d[i]*d[j])
print(sum(ans))

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

Solution (Python):
N = int(input())
M = list(map(int,input().split()))

l = []

num = 0
for i in range(N):
    for j in range(i+1,N):
        num += M[i] * M[j]

print(num)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
D = LIST()

su = 0
for i in range(N):
	for j in range(i+1, N):
		su += D[i]*D[j]

print(su)

Solution (Python):
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)

Solution (Python):
n = int(input())
d_list = list(map(int, input().split()))

ans = 0
for i in range(0, len(d_list)-1):
    for j in range(i+1, len(d_list)):
        ans += d_list[i]*d_list[j]

print(ans)

Solution (Python):
N=int(input())
d=list(map(int,input().split()))

ans=0
for i in range(N-1):
    ans+=d[i]*sum(d[i+1:N])

print(ans)

Solution (Python):
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)

Solution (Python):
N = int(input())
*d, = 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)

Solution (Python):
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)

Solution (Python):
n = int(input())
list = list(map(int, input().split()))

result = 0
for i in range(n-1):
  for j in range(i+1, n):
    result += list[i] * list[j]

print(result)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

answer = 0
for i in range(N):
    for j in range(i+1,N):
        answer += d[i]*d[j]
print(answer)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

answer = 0
for i in range(N):
    for j in range(i+1,N):
        answer += d[i]*d[j]
print(answer)

Solution (Python):
n=int(input())
*d,=map(int,input().split())
ans=[]
for i in range(1,n):
    for j in range(i):
        ans.append(d[i]*d[j])
print(sum(ans))

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

Solution (Python):
N = int(input())
D = list(map(int, input().split()))
ans = 0

for i in range(N):
    for ii in range(i + 1, N):
        ans += D[i] * D[ii]

print(ans)

Solution (Python):
def main():
    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)

if __name__ == '__main__':
    main()

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

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
c=0
for x in range(n):
    for y in range(x,n):
        if x!=y:c+=d[x]*d[y]
print(int(c))

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
ans=0
for _ in range(N-1):
    for j in range(_+1,N):
        ans+=L[_]*L[j]
print(ans)

Solution (Python):
from itertools import combinations

N = int(input())
d = list(map(int, input().split()))
cnt = 0

for i, j in combinations(d, 2):
  cnt += i * j
print(cnt)

Solution (Python):
n = int(input())
a = list(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)

Solution (Python):
N = input()
d = map(int, raw_input().split())
ans = 0
for i in range(N):
  for j in range(i):
    ans += d[i]*d[j]
print ans

Solution (Python):
n = int(input())
d_list = list(map(int, input().split()))

score = 0
for i in range(0, n-1):
    for j in range(i+1, n):
        score += d_list[i] * d_list[j]

print(score)

Solution (Python):
N = int(input())
no_list = list(map(int, input().split()))
sq_list = []
for i in no_list:
  sq_list.append(i ** 2)
print((sum(no_list) ** 2 - sum(sq_list))//2)

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

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

Solution (Python):
N = int(input())
D = list(map(int, input().split()))



prod_sum = 0
for i in range(N):
    for j in range(i+1, N):
        prod_sum += D[i] * D[j]
        
print(prod_sum)

Solution (Python):
n=int(input())
di=list(map(int,input().split()))

sum=0

for i in range(n):
    for j in range(i+1,n):
        sum += di[i]*di[j]

print(sum)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

ans = 0

for i in range(len(d)):
	for j in range(len(d)):
		if i < j:
			ans += d[i] * d[j]

print(ans)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
ans=0

for dd in range(len(d)):
  for e in range(len(d)):
    if dd < e:
      ans+=d[dd]*d[e]
      
print(ans)

Solution (Python):

import sys
import itertools
row = sys.stdin.readline
def read_int(row):
    return int(row().rstrip())
def read_ints(row):
    return list(map(int, row().split()))
  
N = read_int(row)
d_ls = read_ints(row)
print(sum([i[0] * i[1] for i in list(itertools.combinations(d_ls,2))]))

Solution (Python):
n = int(input())
total = 0
d = list(map(int,input().split(" ")))
for i in range(n):
    for j in range(i):
        total += d[i] * d[j]

print(total)

Solution (Python):
N = int(input())
d = input().split()
d = [int(i) for i in d]
l = []
for i in range(N):
  for j in range(i+1,N):
    p = d[i] * d[j]
    if i == j:
      p = 0
    l.append(p)
print(sum(l))

Solution (Python):
n=int(input())
l=list(map(int,input().split()))

ans=0
s=sum(l)

for i in range(n):

    ans+=l[i]*(s-l[i])

print(int(ans/2))

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

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

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
a = 0
for i in range(n):
    for j in range(i):
        a = d[i]*d[j] +a

print(a)

Solution (Python):
import itertools
n=int(input())
d=list(map(int,input().split()))
l=list(itertools.combinations(d,2))
s=0
for i in range(len(l)):
    s+=l[i][0]*l[i][1]
print(s)

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
ans = 0
x = 1
for i in range(n):
    for j in range(n):
        if j + x < n:
            ans += t[i] * t[j+x]
    x += 1
print(ans)

Solution (Python):

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)

Solution (Python):
def solve(inp):
    N = int(inp.readline().strip())
    D = list(map(int, inp.readline().strip().split(' ')))

    r = 0
    for i in range(N - 1):
        for j in range(i + 1, N):
            r += D[i] * D[j]

    return str(r)


def test(s):
    from io import StringIO
    print(solve(StringIO(s)))


def main():
    import sys
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    
    main()

Solution (Python):
n = int(input())
total = 0
takos = [int(i) for i in input().split()]
for _ in range(n - 1):
    curr = takos.pop(0)
    total += curr * sum(takos)

print(total)

Solution (Python):

import sys


def solve(N: int, d: "List[int]"):
    p = 0
    for i in range(N):
        for j in range(i+1,N):
            p = p + d[i] * d[j]
    print(p)
        
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    d = [int(next(tokens)) for _ in range(N)]  
    solve(N, d)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
D = list(map(int,input().split()))

ans = 0
for m in range(0,N-1):
  for n in range(m+1,N):
    ans += D[m] * D[n]
    
print(ans)

Solution (Python):
a=int(input())
import itertools 
b=list(map(int,input().split()))
c=0
for d,e in itertools.combinations(b,2):
  c+=d*e
print(c)

Solution (Python):

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

for i in range(N - 1):
    for j in range(i + 1, N):
        result += D[i] * D[j]
print(result)

Solution (Python):
from itertools import combinations

n = int(input())
d = list(map(int, input().split()))

total = 0
for a, b in combinations(d, 2):
    total += a*b

print(total)

Solution (Python):
N = int(input())
d=list(map(int, input().split()))
 
toori=int((N*(N-1))/2)
p=1
k=0
list_x=[0]*toori
for i in range(N):
  for j in range(N-i-1):
    list_x[(k)]=d[i]*d[p]
    p=p+1
    k=k+1
  p=i+2
kaihuku=0
for i in range(toori):
  kaihuku=kaihuku+(list_x[i])
print(kaihuku)

Solution (Python):

n = int(input())

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

a = []
ans = 0

for i in range(n):
	for j in range(n):
		if i == j:
			pass
		else:
			ans += d[i]*d[j]
		
print(int(ans/2))