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 = list(map(int, input().split()))
answer = 0

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

print(answer)

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

d1 = []
for i in combinations(d,2):
    d1.append(i[0]*i[1])

print(sum(d1))

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=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())
sum = 0
li = [0]*N
for i in range(N):
    li[i] = i+1
li_d = list(map(int, input().split()))
li_comb = list(itertools.combinations(li, 2))
for tpl in li_comb:
    sum += li_d[tpl[0]-1]*li_d[tpl[1]-1]
print(sum)

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

health = []
for i in range(len(a)):
    for j in range(i+1, len(a)):
        health.append(a[i] * a[j])

print(sum(health))

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

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

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

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

for i in range(0,n-1):
    for j in range(i+1,n):
        hp = tako[i] * tako[j]
        sum += hp
print(int(sum))

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

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

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

print(life)

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

Solution (Python):

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

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

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

ans = 0
for i, di in enumerate(d):
    for j, dj in enumerate(d):
        if i > j:
            ans += di * dj

print(ans)

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

print(output)

Solution (Python):
cnt=int(input())
takoyaki=[int(i) for i in input().split()]

ans=0


for j in range(cnt-1):
    
    for k in range(j+1,cnt):
        
        ans+=takoyaki[j]*takoyaki[k]
        
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):
import sys
n = int(input())

d = list(map(int, sys.stdin.readline().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):
from sys import stdin

n = int(stdin.readline().rstrip())
arr = [int(x) for x in stdin.readline().rstrip().split()]

sum = 0
for i,stndrd in enumerate(arr):
    for other in arr[i+1:]:
        sum += stndrd*other

print(sum)

Solution (Python):
import itertools

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

ans = 0
for elms in list(itertools.combinations(d, 2)):
    ans += elms[0]*elms[1]

print(ans)

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

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    A=list(map(int,input().split()))
    s=sum(A)
    t=sum(a**2 for a in A)
    print((s**2-t)//2)
resolve()

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

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

print(ans)

Solution (Python):
N=int(input())
d=[int(i) for i in 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=[int(i) for i in input().split()]
X=sum([i*i for i in d])
print((sum(d)**2-X)//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):
import sys

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

for i in range(n):
    for m in range(i+1,n):
        sum += int(d[i])*int(d[m])

print(sum)

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

print(ans)

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

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

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

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

print((sum(d) ** 2 - sum([i ** 2 for i in d])) // 2)

Solution (Python):
import sys

n = int(sys.stdin.readline())
xs = [int(s) for s in sys.stdin.readline().split(" ")]

result = 0

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

print(result)

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

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

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=input()
d=list(map(int,input().split()))
diag = [x*x for x in d]
sumd = sum(d)
print((sumd**2-sum(diag))//2)

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

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

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

print(ans)

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

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 - 1 - i):
        ans += d[i] * d[N - 1 - j]

print(ans)

Solution (Python):
N = int(input())
d = list(map(int, 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, *D, = [list(map(int, s.split())) for s in open(0)]
N, D = N[0], D[0]
takoyaki_sum = 0
for i in range(N):
    for j in range(N):
        if i != j:
            takoyaki_sum += D[i]*D[j] 
        
print(int(takoyaki_sum/2))

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()))

ret = 0

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

        ret += D[i] * D[j]

print(ret)

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())
l=list(map(int, input().split()))
sum=0
for i in range(n):
  for j in range(i+1,n):
    sum+=(l[i]*l[j])
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()))
LEN = int(((N*(N-1))/2))


ans = []

for i in range(N):
    for j in range(N):
        if i != j:
            ANS = (d[i]*d[j])
            ans.append(ANS)
            
        
        
print(int(sum(ans)/2))

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

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

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

combi = list(itertools.combinations(d,2))
k = len(combi)
s=0
for i in range(k):
    s += (combi[i])[0] * (combi[i])[1]

print(s)

Solution (Python):
n=int(input())
de=[int(x) for x in input().split()]
total=0

i=0

while i<len(de):
	j=i+1
	while j<len(de):
		total+=de[i]*de[j]
		j+=1
	i+=1
	
print(total)

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

Solution (Python):
import sys
import itertools


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    t = 0
    for v in itertools.combinations(a, 2):
        t += v[0] * v[1]
    print(t)


if __name__ == '__main__':
    solve()

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

Solution (Python):



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

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

print(R)

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

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

input()
print(sum(mul(*takoyaki) for takoyaki in combinations(map(int, input().split()), 2)))

Solution (Python):


n = int(input())
d = [int(i) for i 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())
l=list(map(int,input().split()))
sum=0
for i in range(n):
    for j in range(i+1,n):
        sum+=l[i]*l[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):
import itertools

N=int(input())

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

result=0

for x in list(itertools.combinations(tako,2)):
    result += x[0]*x[1]

print(result)

Solution (Python):
N=int(input())
tako=list(map(int,input().split()))
power=0

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

Solution (Python):
N = int(input())
d_list = map(int, input().split())
d = [num for num in d_list]

total = 0
for i in range(len(d)):
    for j in range(len(d)):
        if i<j:
            total = 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(i+1,n):
        if i != j:
            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):
  count+=d[i]*(sum(d[i:N])-d[i])

print(count)

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

cumsum = 0
for n in range(N):
    cumsum += d[n]
sub_cumsum = 0
ans = 0
for n in range(N):
    sub_cumsum += d[n]
    ans += d[n] * (cumsum-sub_cumsum)
print(ans)

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

import numpy as np
d = np.array(d)

print( ( (np.sum(d))**2 - np.sum(d**2) ) // 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):
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):
import sys

num = int(input())
tako = list(map(int, input().split()))
ans=0
for index1 in range(num-1):
	for index2 in range(index1+1,num):
		sum = tako[index1]*tako[index2]
		
		ans = ans+sum
print(ans)

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

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

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

print(ans)

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

def main():
    n = int(input())
    t = tuple(map(int, input().split()))
    print(sum([t[i] * t[j] for i in range(n) for j in range(i+1, n)]))

if __name__ == '__main__':
    main()

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

def main():
    n = int(input())
    t = tuple(map(int, input().split()))
    print(sum([t[i] * t[j] for i in range(n) for j in range(i, n) if i != j]))

if __name__ == '__main__':
    main()

Solution (Python):


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

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

print(total)

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

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

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

from itertools import combinations
import numpy as np
sum=0
base = list(combinations(d,2))
for i in range(len(base)):
    sum+=base[i][0]*base[i][1]

print(sum)

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

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

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

Solution (Python):
n = int(input())
d_lis = list(map(int, input().split()))
ans = 0
tmp = 0
for i in range(n):
    for v in range(n):
        if i == v:
            pass
        else:
            tmp = d_lis[i] * d_lis[v]
            ans += tmp
print(ans//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):
import itertools
n = int(input())
d = [int(i) for i in input().split()]

c = list(itertools.combinations(d,2))
ans = 0 
for x,y in c:
    ans += x * y
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):

import sys
import itertools


def solve(N: int, d: "List[int]"):
    combi = itertools.combinations(d, 2)
    sum = 0
    for item in combi:
        sum += item[0] * item[1]
    print(sum)
    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()))
print(sum([d[i]*d[j] for i in range(n-1) for j in range(i+1,n)]))

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

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

print(res)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
nums=[x for x in range(n)]
ans=[]
for i in nums[:n-1]:
  for j in l[i+1:]:
    m=l[i]*j
    ans.append(m)
print(sum(ans))

Solution (Python):
from itertools import combinations

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

cand = []
for x, y in combinations(D, 2):
    cand.append(x * y)

ans = sum(cand)
print(ans)

Solution (Python):
from itertools import *

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

for i, j in product(range(N), range(N)):
    if i < j:
        total += D[i] * D[j]

print(total)

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

sum = 0

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

print(sum)

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

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

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

Solution (Python):
from itertools import combinations

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

total = 0
for pat in combinations(range(n), 2):
    total += ds[pat[0]] * ds[pat[1]]
print(total)

Solution (Python):
from functools import reduce
from operator import add

n = int(input())
l1 = [int(i) for i in input().split()]
print(reduce(add, [l1[a]*l1[b] for a in range(n-1) for b in range(a+1,n)]))

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

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

Solution (Python):
N = int(input())
d = [int(di) for di in 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().strip())
d=list(map(int,input().strip().split()))
sum_=0
for i,x in enumerate(d):
  for y in d[i+1:]:
      sum_+=x*y
print(sum_)

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

for i in range(n):
    t = d.pop(0)
    ans += t*sum(d)

else:
    print(ans)

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

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

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

result = 0

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

Solution (Python):

def main():
    N = int(input())
    K = [int(x) for x in input().split()]
    ans = 0
    for n in range(0, N):
        for k in range(n+1, N):
            ans += K[n] * K[k]
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
takoyaki_len = int(input())
takoyaki_good = input().split()
recovery = 0

i = 0
while (i < takoyaki_len):
    j = i+1
    while (j < takoyaki_len):
        recovery += int(takoyaki_good[i]) * int(takoyaki_good[j])
        j += 1
    i += 1

print(recovery)

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 = a + (d[i] * d[j])

print(a)

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

a = []

for i1 in range(n):
    for i2 in range(n):
        if i1 != i2:
            a.append(d[i1] * d[i2])

print(int(sum(a) / 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):
import itertools
N = int(input())
d = list(map(int, input().split()))
ans = 0
for x, y in itertools.combinations(d,2):
    ans += x * y
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):
        a = d[i] * d[j]
        ans = ans + a

print(ans)

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

 
    if n==len(s):
        break
x=0
for i in range(0,n):
    for j in range(i+1,n):
        x+=s[i]*s[j]

print(x)

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


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

Solution (Python):

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

Solution (Python):


N = int(input())
D = list(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 = (sum(d)**2 -sum([x*x for x in d]))//2
print(ans)

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

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

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

    print(sum)

def main():
    ABC143B_TakoyakiFes()

if __name__ == "__main__":
    main()

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

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, 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)]
mod = 1000000007
inf = float('INF')


def A():
    a, b = LI()
    print(max(0, a - 2 * b))
    return


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


def C():
    n = II()
    s = S()
    i = 0
    ans = 1
    for i in range(1, n):
        if s[i - 1] == s[i]:
            continue
        ans += 1
    print(ans)
    return


def D():
    n = II()
    l = LI()
    l.sort()
    ans = 0
    for i in range(n - 1, 0, -1):
        for k in range(i - 1, -1, -1):
            ab = l[i] - l[k]
            c = max(0, k - bisect_right(l, ab))
            ans += c
    print(ans)
    return


def E():
    n, m, l = LI()
    dist = [[inf] * n for i in range(n)]

    for _ in range(m):
        a, b, c = LI_()
        c += 1
        if c > l:
            continue
        dist[a][b] = c
        dist[b][a] = c

    supply = [[n] * n for i in range(n)]
    for k in range(n):
        distk = dist[k]
        for i in range(n):
            if i == k:
                continue
            disti = dist[i]
            distik = dist[i][k]
            for j in range(i + 1, n):
                if distik + distk[j] < disti[j]:
                    disti[j] = distik + distk[j]
                    dist[j][i] = disti[j]

    lis = [[] for i in range(n)]
    for i in range(n):
        for j in range(i + 1, n):
            if dist[i][j] <= l:
                supply[i][j] = 0
                supply[j][i] = 0
                lis[i].append(j)
                lis[j].append(i)

    for i in range(n):
        q = []
        for k in lis[i]:
            heappush(q, (0, k))
        supplyi = supply[i]

        while q:
            time, p = heappop(q)
            for k in lis[p]:
                if supplyi[k] > time + 1:
                    supplyi[k] = time + 1
                    heappush(q, (time + 1, k))

    q = II()
    for _ in range(q):
        s, t = LI_()
        if dist[s][t] == inf:
            print(-1)
            continue
        else:
            print(supply[s][t])
    return



def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    B()

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

print(s)

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

for i in range(len(d)):
    for j in range(i,len(d)):
        if i != j:
            s+= d[i]*d[j]

print(s)

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

combination = list(combinations(D,2))
total = 0

for i in combination:
    total = total + (i[0] * i[1])

print(total)

Solution (Python):
import itertools
N = int(input())
d = list(map(int, input().split()))
ans = 0
for i,j in list(itertools.combinations(d,2)):
  ans += i*j
print(ans)

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

Solution (Python):
def solve(ds) -> int:
  ret = 0
  for i in range(len(ds)):
    for j in range(i + 1, len(ds)):
      ds_i = ds[i]
      ds_j = ds[j]
      ret += ds_i * ds_j
  return ret


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

print(solve(ds))

Solution (Python):
import itertools

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

print(sum(x*y for x, y in itertools.combinations(t, 2)))

Solution (Python):
import itertools

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

print(t)

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

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

Solution (Python):
import sys
import itertools

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  


n = ni()
d = na()
res = 0
for v in itertools.combinations(d, 2):
    res += v[0] * v[1]
print(res)

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

s = sum(l)
c = 0
for i in l:
  c += (s-i)*i
  
print(c//2)

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

ans = 0
for c in itertools.combinations(d, 2):
    ans += c[0]*c[1]

print(ans)

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

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

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

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

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

print(ans)

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

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

print(ans//2)

Solution (Python):
import sys

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

for x in range(0,N-1):
    for y in range(x+1, N):
        sum+=d[x]*d[y]

print(sum)

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