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):
n=int(input())
d=input()
D=d.split()
ans=0
for i in range(len(D)):
	D[i]=int(D[i])
for j in range(len(D)):
	for k in range(j+1,len(D)):
		ans+=D[j]*D[k]
print(ans)

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

Solution (Python):
a = int(input())
b = list(map(int,input().split()))
c = int((a*(a-1))/2)
d = len(b)
f = 0
for i in range(d-1):
  for j in range(i+1,d):
    f += b[i]*b[j]
print(f)

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

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

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

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
while len(d) > 1:
    current = d[0]
    for y in range(len(d)):
        ans += current * d[y]

    ans -= current ** 2
    d.pop(0)
print(ans)

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

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

print(total)

Solution (Python):
import sys
from itertools import combinations


def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    d = map(int, input().split())
    ans = 0
    for x, y in combinations(d, 2):
        ans += x * y

    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):
N = input()
D = list(map(int, input().split()))
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(" ")))
count = []
for i in range(n-1):
  for j in range(i+1,n):
    cure = d[i]*d[j]
    count.append(cure)
print(sum(count))

Solution (Python):
import itertools
N = int(input())
dmat = input().split()
dmatint = []
for i in range(len(dmat)):
    dmatint.append(int(dmat[i]))





allpatern = list(itertools.combinations(range(N), 2))

sum = 0
for patern in allpatern:
    first = patern[0]
    second = patern[1]
    
    
    product = dmatint[first]*dmatint[second]
    sum += product
print(sum)

Solution (Python):

import itertools

n = int(input())
l = [int(s) for s in input().split()]
ans = 0
for v in itertools.combinations(l, 2):
    ans += v[0]*v[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):
n = int(input())
d = input().split()
d = [int(a) for a in d]
s = 0

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

print(s)

Solution (Python):

import itertools
 
N = int(input())

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

ans = 0

for i in itertools.combinations(li, r=2):
    ans += i[0] * i[1]
    
print(ans)

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

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):
import itertools

B = int(input())
D = list(map(int,input().split()))
ans_list = list(itertools.combinations(D, 2))
ans = 0
for i,j in ans_list:
    ans += (i * j)
print(ans)

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

result = 0
for i, di in enumerate(d):
    for j in range(N-i-1):
        j+=1
        result+=d[i]*d[-j]

print(result)

Solution (Python):
def calc(N, d):
    r = 0
    for i in range(N):
        for j in range(i + 1, N):
            r += d[i] * d[j]

    return r


N = int(input())
d = [int(s) for s in input().split()]
print(calc(N, d))

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

Solution (Python):
N = int(input())
takoyakis = list(map(int, input().split()))
sum = 0
for i, takoyaki in enumerate(takoyakis):
    for t in takoyakis[i + 1:]:
        sum += takoyaki * t
print(sum)

Solution (Python):
n = input().split(" ")
i = input().split(" ")
i = [int(k) for k in i]

r = (sum(i) * sum(i) - sum([j * j for j in i])) / 2
r = int(r)

print(r)

Solution (Python):


import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        
        
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = [int(e) for e in lines[0].split(" ")][0]
    d = [int(e) for e in lines[1].split(" ")]

    return (n, d)


def solve(n, d):

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

    return s


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

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

Solution (Python):
import itertools

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


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

sum_list = 0
for i in range(len(list)):
    sum_list += list[i][0] * list[i][1]

print(sum_list)

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

Solution (Python):
N=int(input())
d=list(map(int,input().split()))
ans = 0
for i,x in enumerate(d):
    for y in d[i+1:]:
        ans+=x*y
print(ans)

Solution (Python):

import sys
import itertools


def solve(N: int, d: "List[int]"):
    total = 0
    for v in itertools.combinations(d, 2):
        total += v[0] * v[1]
    print(total)
    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=input()
D=D.split()
D=[int(item) for item in D]
ans=0
for i in range(len(D)):
    for j in range(i+1,len(D)):
        ans+=D[i]*D[j]
print(ans)

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

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

print(count)

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

a = list(itertools.combinations(d,2))
v = 0
for c in a:
  v += c[0]*c[1]
  
print(v)

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

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

ans = 0
for i in range(N):
    for t in range(i + 1, N):
        ans += list_d[i] * list_d[t]
print(ans)

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

sum = 0
for i in range(N):
  for m in range(i+1, N):
    xy = d_list[i]*d_list[m]
    sum += xy

print(sum)

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

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

print(cnt)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
i=0
j=0
p=0
while(i<len(a)):
  j=i+1
  s=0
  while(j<len(a)):
      s=s+a[j]
      j=j+1
  
  p=p+s*a[i]
  i=i+1
print(p)

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

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

Solution (Python):
a =int(input())
B =list(map(int, input().split()))
C = 0
for i in range(a):
    for j in range(a):
        if i==j:
            break
        else:
            C += B[i]*B[j]
print(C)

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 and i < j:
            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 j in range(N):
    if i==j:
      continue
    ans+=d[i]*d[j]/2
print(int(ans))

Solution (Python):
N = int(input())
A = list(map(int, input().split())) 
sum = 0

for i in range(N):
    for j in range(N-i-1):
        sum += A[i] * A[i+1+j]
        
print(sum)

Solution (Python):
N = int(input())
D = [int(i) for i in input().split()] 
C = 0
for i in range(N):
	for j in range(N):
		if i<j:
			C+=D[i]*D[j]

print(C)

Solution (Python):
import itertools

N = int(input())
d_list = [int(x) for x in input().split()]

result = 0
comb = itertools.combinations(d_list, 2)
for pattern in comb:
    result += pattern[0] * pattern[1]

print(result)

Solution (Python):
import sys
input = sys.stdin.readline

_n = int(input())
dlist = [item for item in map(int, input().split())]

sd = 0
while len(dlist) > 1:
    sd += dlist[0] * sum(dlist[1:])
    dlist = dlist[1:]


print(sd)

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:
            continue
        else:
            total += d[i] * d[j]
print(total // 2)

Solution (Python):
import itertools
import sys
readline = sys.stdin.readline

N = int(readline())
ds = list(map(int,readline().split()))

ans = 0
for v in itertools.combinations(ds, 2):
    
    ans += v[0] * v[1]
    
print(ans)

Solution (Python):
def A():
    temp = [int(i) for i in input().split()]
    print(max(0, temp[0]-2*temp[1]))

def B():
    N = int(input())
    T = [int(i) for i in input().split()]
    s = 0
    for i in range(N):
        for j in range(i):
            s += T[i]*T[j]
    print(s)

B()

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):
import itertools

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

combination = list(itertools.combinations(d, 2))
taste_sum = 0

for i in combination:
    taste_sum += i[0] * i[1]

print(taste_sum)

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

s = sum(L)
p = 0
for a in L:
 p += a*a

ans=(s*s-p)/2

print(int(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())
li = list(map(int,input().split()))
score = 0
for i in range(n):
  for j in range(n):
    if i < j:
      score = score + li[i]*li[j]
print(score)

Solution (Python):
N = int(input())
list = input().split()
d = [int(n) for n in list]
sum = 0
sum_minus = 0
for i in range(N):
  sum_minus += d[i]*d[i]
  for k in range(N):
    sum += d[i]*d[k]
print(int((sum - sum_minus)/2))

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

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

print(ans)

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

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

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

print(result)

Solution (Python):
n = int(input())
d = input().split()
for i in range(n):
	d[i] = int(d[i])
re = 0
for i in range(n):
	for j in range(i+1,n):
		if i == j:
			break
		else:
			re += d[i]*d[j]


print(re)

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

Solution (Python):
def inpl(): return list(map(int, input().split()))

N = int(input())
D = inpl()
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=input().split()
di = [int(s) for s in d]
a=0
for i in range(0,n):
  for j in range(i+1,n):
    a+=di[i]*di[j]
print(a)

Solution (Python):
import itertools
N = int(input())
d = list(map(int,input().split()))
tmp = list(itertools.combinations(d,2))
ans = 0
for i in range(len(tmp)):
    ans = ans + (tmp[i][0] * tmp[i][1])
print(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] + sum
print(sum)

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

p = 0
l = len(d)
for i in range(l-1):
    if d[i] == 0:
        continue
    else:
        for j in range(i+1, l):
            p += d[i] * d[j]
print(p)

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

s = 0
while len(D) > 0:
  d = D.pop(0)
  s += d * sum(D)
  
print(s)

Solution (Python):
n = int(input())
d = [x for x in map(int, input().split())]

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

Solution (Python):
import sys

def main():

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


if __name__ == "__main__":
	main()

Solution (Python):
import itertools

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


def solve():
    point = 0

    for pattern in list(itertools.combinations(D, 2)):
        point += pattern[0] * pattern[1]

    return point


print(solve())

Solution (Python):
N = int(input())
d = [i for i in 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()))
answer = 0
for i in range(len(D)):
    for j in range(i, len(D)):
        if i != j:
            answer += D[i]*D[j]
print(answer)

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

	print(sum)

main()

Solution (Python):
import itertools

takoyaki_num = int(input())
takoyaki_hp = input().split()

takoyaki_combi = itertools.combinations(takoyaki_hp , 2)
heal_hp = 0
for takoyakis in list(takoyaki_combi):
    heal_hp_of = 1
    for takoyaki in takoyakis:
        heal_hp_of *= int(takoyaki)
    heal_hp += heal_hp_of
print(heal_hp)

Solution (Python):
N=int(input())
d=[int(n) for n in input().split()]
memo=[]
ans=0
for i in range(N):
    for j in range(N):
        if (i,j) in memo or (j,i) in memo or i==j:
            pass
        else:
            ans += d[i]*d[j]
            memo.append((i,j))
print(ans)

Solution (Python):

import itertools

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

xx = itertools.combinations(D, 2)
out = 0
for x in xx:
    out += x[0] * x[1]
print(out)

Solution (Python):
import itertools
n = input()
d = list(map(int, input().split()))
lis = list(itertools.combinations(d,2))
ans = 0
for e in lis:
    ans += e[0] * e [1]
print(ans)

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

Solution (Python):
import itertools
import numpy as np

N = input()
d_list = list(map(int,input().split()))
ans = 0

for v in itertools.combinations(d_list, 2):
  ans += np.prod(v)
  
print(ans)

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

Solution (Python):
import numpy as np

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

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

print(ans)

Solution (Python):
from itertools import combinations
N = input()
D = [int(x) for x in input().split()]
ans = 0
for x, y in combinations(D, 2):
    ans += x*y
print(ans)

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

c=0

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

    c+=d[i]*d[j]
print(c)

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

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

while N > 1:
    for i in range(N - 1):
        point = d[0] * d[i + 1]
        count = count + point
    N = N - 1
    del d[0]

print(count)

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

d = [int(x) for x in input().split()]
r = 0
for i in range(n):
    r += d[i]*d[i]

ans = (sum(d)*sum(d) - r)//2
print(ans)

Solution (Python):
import itertools
N = int(input())
D = [int(_) for _ in input().split()]
ans = 0
for i, j in itertools.combinations(range(N), 2):
    ans += D[i] * D[j]
print(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-1):
    for n in range(len(D)-1):
        ans += D[0]*D[n+1]
    del D[0]
print(ans)

Solution (Python):
inpl = lambda: list(map(int,input().split()))
N = int(input())
d = inpl()
S = sum(d)
T = sum(x**2 for x in d)
print((S**2-T)//2)

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

Solution (Python):
N = int(input())
de = list(input().split())

Ans = 0
for i in range(N):
    for j in range(N):
        if i != j:
            Ans += int(de[i]) * int(de[j])

print(int(Ans / 2))

Solution (Python):
n = int(input())
oisisa = list(map(int,input().split()))
oisisa_2 = []
for i in range(n):
    oisisa_2.append(oisisa[i] ** 2)
sum_2 = sum(oisisa_2)
count = 0
for i in range(n):
    for j in range(n):
        count += oisisa[i] * oisisa[j]
print(int((count - sum_2) / 2))

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

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

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

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

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

Solution (Python):
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//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 i>=j:
            continue

        ans+=d[i]*d[j]

print(ans)

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

sum = 0
for i in range(N):
  for j in range(i):
    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-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()))
M=0
for i in range(N):
    for j in range(i+1,N):
        M+=d[i]*d[j]
print(M)

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

print(sum)

Solution (Python):
import itertools

def b():
    n = map(int, input())
    ds = list(map(int, input().split()))
    cs = list(itertools.combinations(ds, 2))

    sum_ = 0

    for c in cs:
        sum_ += c[0] * c[1]

    print(sum_)

if __name__ == '__main__':
    b()

Solution (Python):
n=int(input())
d=list(int(x) for x in input().split())

sum=0

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

Solution (Python):
n = int(input())
src = list(map(int, input().split()))
def calc_sum(tmp_list):
    score = 0
    while len(tmp_list)>1:
        tmp = tmp_list.pop(0)
        for l in tmp_list:
            score += tmp * l
    return score
print(calc_sum(src))

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

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

print(ans)

Solution (Python):
N = int(input())
box = list(map(int, input().split()))
answer = []
for i in range(len(box)):
  ans = box[i] * sum(box[i+1:])
  answer.append(ans)
print(sum(answer))

Solution (Python):
n=int(input())
d=[int(i) for i in input().split()]
total=0
for i in range(0,n-1):
    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()))

D_2=sum([a**2 for a in D])

ans=0
for i,a in enumerate(D):
  for b in D[i:]:
    ans+=a*b
print(ans-D_2)

Solution (Python):
N=int(input())
D=list(map(int,input().split()))
S=sum(D)
C=0
for i in D:
  C+=i*(S-i)
print(int(C/2))

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()))
ret=0
for di in d:
  ret+=di*(sum(d))-di**2
print(ret//2)

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

from itertools import combinations

combi = list(combinations(ls, 2))

s = 0
for a, b in combi:
    s += (a * b)

print(s)

Solution (Python):
import itertools as it

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

total = 0
for x, y in it.combinations(d, 2):
    total += x * y

print(total)

Solution (Python):
from itertools import combinations

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

print(sum(x * y for x, y in combinations(d, 2)))

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

Solution (Python):
n = int(input())
d=[]
d[:]=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):
import itertools

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

yum_combs = list(itertools.combinations(yums, 2))
sumyum = sum([x * y for x, y in yum_combs])

print(sumyum)

Solution (Python):
N = int(input())
d = input()
d_s = d.split(" ")
j = 0
ans = 0
for i in range(N):
    j = i + 1
    while j < N:
        ans = ans + int(d_s[i]) * int(d_s[j])
        j = j + 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):
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]


def sosu(x):
    for i in range(2, int(sqrt(x)+1)):
        if x % i == 0:
            return False
    return True


mod = 1000000007
inf = float('INF')


def A():
    A, B = LI()
    ans = A-2*B
    if ans > 0:
        print(ans)
    else:
        print(0)
    return




def B():
    N = II()
    d = LI()
    ans = 0
    for i in range(N):
        for x in range(i+1, N):
            ans += d[i]*d[x]
    print(ans)

    return




def C():
    N = II()
    A = LI()
    J = [0] * N
    for i, n in enumerate(A):
        J[n-1] = i+1
    for s in J:
        print(s, end=" ")

    return




def D():
    A, B = map(int, input().split())
    g = gcd(A, B)
    
    
    sq = int(sqrt(g)) + 2
    ans = 1

    for i in range(2, sq):
        if g % i == 0:
            ans += 1
        while g % i == 0:
            g /= i

            
        if g == 1:
            break
        if i == sq - 1:
            
            ans += 1

    print(ans)

    return




def E():
    N, M = LI()
    bit_max = 1 << N
    dp = [[inf for i in range(bit_max)] for j in range(M+1)]
    dp[0][0] = 0

    for i in range(M):
        a, b = LI()

        c = LI()
        bit = 0

        for d in c:
            bit |= 1 << (d-1)

        for w in range(bit_max):

            t = w | bit
            cost = dp[i][w] + a

            dp[i+1][t] = min(dp[i+1][t], cost)

            dp[i+1][w] = min(dp[i][w], dp[i+1][w])

    print(-1) if dp[-1][-1] == inf else print(dp[-1][-1])

    return




def F():
    N, M = LI()

    value = [0] * M
    power = [0] * M
    for i in range(M):
        a, b = LI()
        value[i] = a
        c = LI()
        L = ['0'] * N
        for k in c:
            L[k - 1] = '1'
        bint = ''.join(L)
        power[i] = int(bint, 2)
    bint = ''.join(list(['1'] * N))
    dp = [inf] * (int(bint, 2)+1)
    t = 0
    cost = 0

    dp[0] = 0
    for s in range(int(bint, 2) + 1):
        for i in range(M):
            t = s | power[i]
            cost = dp[s] + value[i]
            dp[t] = min(dp[t], cost)
    print(-1) if(dp[-1] == inf) else print(dp[-1])

    return

    



def solution(S):
    
    import math

    vowels = "AIUEO"
    count = 0
    consonants = 0
    newC = []
    newV = []

    for i in S[:-1]:
        if i in vowels:
            count += 1
            newV.append(i)
        else:
            consonants += 1
            newC.append(i)

    if consonants < count or consonants - 2 > count:
        return 0

    a = math.factorial(len(set(newC))) * math.factorial(len(set(newV)))
    return a

    pass



if __name__ == '__main__':
    B()

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

Solution (Python):
from itertools import combinations, starmap
from operator import mul

N = int(raw_input())
d = map(int, raw_input().split())
print sum(starmap(mul, combinations(d, 2)))

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

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

Solution (Python):

import sys
import itertools


def solve(N: int, d: "List[int]"):
    result = 0
    for pair in itertools.combinations(d, 2):
        result += pair[0] * pair[1]
    print(result)
    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()))


total = sum(d)

answer = 0
for i in range(N):
    answer += d[i]*(total-d[i])
answer = answer//2

print(answer)

Solution (Python):
N = int(input())
oisisa = list(map(int,input().split()))
result=0
for i in range(N):
    if oisisa[i] == 0:
            pass
    else:
        for j in range(N-i-1):
            result += oisisa[i]*oisisa[i+j+1]
print(result)

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
count = 0

for i in range(N):
  for j in range(N):
    if i != j and i < j:
      count += A[i]*A[j]
    
    
  
print(count)

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

print(s)

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

tmp = []
for i in range(len(Di)-1):
    for k in range(len(Di[i:])-1):
        tmp.append(Di[i] * Di[i+k+1])

print(sum(tmp))

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)