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
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
D = iil()
sumD = sum(D)
ans = 0
for i in range(n):
    ans += D[i]*(sum(D)-D[i])
print(ans//2)

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
D = iil()
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()))
res = 0
sq = 0

for i in range(N):
    res += d[i]
    sq += d[i]**2
print((res**2-sq)//2)

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()))
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
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
D = lr()
D2 = np.array(D)
E = D2[:, None] * D2[None, :]
E *= (np.ones((N, N), dtype=np.int32) - np.eye(N, dtype=np.int32))
answer = E.sum() // 2
print(answer)

Solution (Python):
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
D = lr()
D2 = np.array(D)
answer = 0
for d in D:
    answer += (d * D2).sum() - (d ** 2)

print(answer // 2)

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

ans = 0

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

print((a*a-b)//2)

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

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

N = int(input())
d = list(map(int, input().split()))
com = itertools.combinations(d,2)
ans = 0
for c in com:
    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-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()))
ans = 0

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

print(ans)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
souwa = 0
x = 1
s = []
for a in d:
    souwa += sum(a * d[x:])
    x += 1

print(souwa)

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 = input()
d = [int(i) for i in input().split()]
print((sum(i for i in d)**2 - sum(i**2 for i in d))//2)

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

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

comb = combinations(d, 2)
amount = 0
for d1, d2 in comb:
    amount += d1 * d2
    
print(amount)

Solution (Python):
import numpy as np
N = int(input())
d = np.array(list(map(int, input().split())))
print(sum(sum(np.triu(d[:, np.newaxis] * d, k = 1))))

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=[0]*n
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()))
c = 0
for i in range(N):
    for m in range(N-1-i):
        c +=d[i]*d[m+i+1]
print(c)

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()))
S_d = sum(d)
ans = 0
for i in d:
    ans += i*(S_d-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(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]
print(ans//2)

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

print(ans)

Solution (Python):
from itertools import combinations


def solve():
    n = int(input())
    D = map(int, input().split())

    dct = {}
    sm = 0
    for a, b in combinations(D, 2):
        sm = sm + a * b
    print(sm)


if __name__ == '__main__':
    solve()

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 = list(map(int, input().split()))
S = list(itertools.accumulate(D))

ans = 0
for i in range(N-1):
    ans += D[i]*(S[-1]-S[i])
print(ans)

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

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

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

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

print(ans)

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

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

print(ans)

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

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

Solution (Python):
n = int(input())
L = list(map(int,input().split()))
from itertools import product
sum1 = 0
for i in product(L,repeat =2):
    
    if i[0] != i[1]:
        sum1 += (i[0]*i[1])

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()))
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 =0
for i,dx in enumerate(d):
    if i+1 <len(d):
        for k,dy in enumerate(d[i+1:]):
            sum+=dx*dy

print(sum)

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

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

Solution (Python):
import itertools

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

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

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

print(result)

Solution (Python):
import sys

input = sys.stdin.readline

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

power=0

for i in range(n):
  for j in range(n):
    if i!=j:
      power+=dd[i]*dd[j]
print(power//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-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(n-i-1):
        ans += d[i]*d[i+j+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 = 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())
l = list(map(int, input().split()))
l2 = []
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())
dlist = list(map(int,input().split()))
anslist = list(dlist[i]*dlist[j] for i in range(n) for j in range(i+1,n))
print(sum(anslist))

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

res = 0
for i in range(N-1):
  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()))
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()]

ans = (sum(d)) ** 2

for dd in d:
  ans -= dd ** 2

print(ans//2)

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

for i in range(n):
  for k in range(n):
    if i == k:
      continue
    else:
      total += d[i] * d[k]
      
print(total//2)

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

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

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

Solution (Python):








import math


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()
l = map(int,raw_input().split())
a = 0
for i in xrange(n):
    for j in xrange(i+1,n):
        a +=  l[i]*l[j]
print a

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

s = (sum(D)**2 - sum(d*d for d in D))//2


print(s)

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

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
import itertools as it

def main():
    N = int(input())
    ds = input_nums()
    total = 0
    dd = it.permutations(ds, 2)
    for d in dd:
        total += d[0] * d[1]
    print(total//2)

if __name__ == '__main__':
    main()

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

Solution (Python):
tako = int(input())
tako_oisisa =  [int(i) for i in input().split()]
answer = 0
for i in range(tako):
  for s in range(tako):
    if i == s:
        continue
    else:
        answer += tako_oisisa[i]*tako_oisisa[s]
print(int(answer/2))

Solution (Python):


N = int(input())
d =list(map(int,input().split()))
h = 0
for i in range(N-1):
    x = d.pop(0)
    h += x*sum(d)
print(h)

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

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

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

l_a = [k * j for i, k in enumerate(l) for j in l[i + 1:]]

print(sum(l_a))

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(n):
    if i > j:
      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]

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

for i in range(n):
  ans -= d[i] ** 2

print(ans//2)

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

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

Solution (Python):
import numpy as np
n = int(input())
d = list(map(int,input().split()))
print(int((np.sum(np.array(d))**2 - np.sum(np.array(d)**2)) /2))

Solution (Python):


N = int(input().strip())
d_list = list(map(int, input().rstrip().split()))


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

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

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

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

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

Solution (Python):
out = 0
num = int(input())
kaihukuryou = list(map(int, input().split()))
kumiawase_sum = num * (num - 1) / 2
for i in range(num - 1):
  for j in range(i,num - 1):
    out = out + kaihukuryou[i] * kaihukuryou[j + 1]
print(out)

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

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::])
print(ans)

Solution (Python):
N=int(input())
D=list(map(int,input().split()))
from itertools import combinations
comb=combinations(D, 2)
ans=0
for c in comb:
    ans+=c[0]*c[1]
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 += d[i]*d[j]
print(count)

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

Solution (Python):
n=int(input())
List=[int(i) for i in input().split()]
ans=0
for i in range(0,n-1):
  for r in range(i+1,n):
    a=List[i]
    b=List[r]
    ans=ans+a*b
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):
a = int(input())
b = [int(x) for x in input().split()]

def pairs1(b, pairs=[], func=lambda x,y: x*y):
  if b == []:
    return pairs
  return pairs1(b[1:], pairs+[func(b[0], x) for x in b[1:]])

print(sum(pairs1(b)))

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

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

L = [d[x]*d[y] for x in range(N) for y in range(x+1,N)]
print (sum(L))

Solution (Python):
N = int(input())
d = tuple(map(int,input().split()))
sum = 0

for x in range(len(d)):
    for y in range(x+1,len(d)):
        sum += d[x]*d[y]
print(sum)

Solution (Python):
N = int(input())
d = tuple(map(int,input().split()))
sum = 0

for x in range(len(d)):
    for y in range(x+1,len(d)):
        sum += d[x]*d[y]
print(sum)

Solution (Python):
from itertools import combinations

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

l = [x * y for x, y in combinations(d, 2)]
print(sum(l))

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]

print(int(ans/2))

Solution (Python):
from itertools import combinations

def solve():
    N = int(input())
    A = list(map(int, input().split()))
    c = 0
    for a, b in list(combinations(A, 2)):
        c += a*b

    return c

print(solve())

Solution (Python):
import itertools

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

P = itertools.combinations(D,2)
sum = 0
for p in P:
  sum += p[0]*p[1]
print(sum)

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

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

su = 0

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

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
n = int(input())
d = list(map(int, input().split()))
comb = combinations(d, 2)
ans = [i[0]*i[1] for i in comb]
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):

"""
Created on Thu Mar 12 01:42:08 2020

@author: Kanaru Sato
"""

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

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

print(energy)

Solution (Python):
N=int(input())
d=input().split()
S = 0

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

S = S//2

print(S)

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

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

print(out)

Solution (Python):
import sys

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

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):
import itertools
n = int(input())
d = list(map(int, input().split()))
comb = itertools.combinations(list(d), 2)
a = 0
for i,j in comb:
    a += i*j
print(a)

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





import numpy as np



n = int(input())

arrD = np.array(input().split(),dtype=np.int64)

AA,BB = np.meshgrid(arrD,arrD)
a = np.dot(AA.flatten(),BB.flatten())

b = sum(arrD**2)


ans = (a-b)//2

print(ans)

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

import itertools

total = 0

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

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

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

for i in range(n):
    for j in range(i+1, n):
        hp += takoyaki[i] * takoyaki[j]
        
print(hp)

Solution (Python):
import itertools

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

    result = 0

    for i in itertools.permutations(d,2):
        result += i[0] * i[1]

    print(result // 2)


if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
A = input()
N = list(map(int,input().split()))
ans = 0
for i in range(len(N)):
  for j in range(i,len(N)):
    if i != j:
      ans += N[i]*N[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(N):
        if i < j:
            a = a+D[i]*D[j]
print(a)

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

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

print(total)

Solution (Python):
def main():
    n=int(input())
    l= list(map(int, input().split()))
    s=sum(l)
    a=0
    for i in range(n):
        a+=l[i]*(s-l[i])
    print(a//2)
    return
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 = [int(x) for x in input().split()]
D.sort(reverse=True)
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())
numbers = input().split(" ")
total = 0
d = 0
for i in numbers:
    d += int(i)**2
    s = 0
    for j in numbers:
        s += int(j)
    total += s*int(i)
ans = total - d
print(int(ans/2))

Solution (Python):
N = int(input())
d_li = list(map(int, input().split()))
s = 0
from itertools import combinations
for i in combinations(d_li, 2) :
    l = list(i)
    s += l[0] * l[1]
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+1, N):
        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-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()))
K=[]
while len(D)>1:
    for i in range(len(D)-1):
        kaihuku=D[0]*D[i+1]
        K.append(kaihuku)
    D.pop(0)
print(sum(K))

Solution (Python):
N=int(input())
d=list(input().split())
tot=0
for i in d:
  for j in d:
    tot+=int(i)*int(j)
for k in d:
  tot-=int(k)*int(k)
print (tot//2)

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


sum = 0
for count1 in range(N-1):
    for count2 in range(count1+1,N):
        sum = sum  + D[count1]*D[count2]

print(sum)

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

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

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

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

print(sum)

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

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

for i in range(len(d)):
    for j in range(i+1,len(d)):
        d_new.append(d[i]*d[j])

print(sum(d_new))

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):
import itertools
N = int(input())
l = list(map(int,input().split()))
a = 0
for i,j in itertools.combinations(l,2):
  a += i*j
print(a)

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())
List = [int(j) for j in input().split(" ")]
Sum = 0
for n in range(0,N-1):
  for m in range(n+1,N):
    Sum += List[n]*List[m]
print(Sum)

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

t=0
for hp in [[x*y for y in d] for x in d]:
    
    t+=sum(hp)
kaburi=[i*i for i in d]
print((t-sum(kaburi))//2)

Solution (Python):
import sys
import math

a=int(input())
li= [int(x) for x in input().split()]
i=j=sum=0
for i in range(len(li)-1):
  for j in range(len(li)-i-1):
    sum+=li[i]*li[i+j+1]
print(sum)

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

print(s)

Solution (Python):
from sys import stdin
import itertools

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

heal = itertools.combinations(d, 2)

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

print(total)

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

ans = 0

for n in range(N):
    for i, d in enumerate(D):
        if i == n:
            continue
        else:
            ans += d * D[n]
print(int(ans/2))

Solution (Python):
import sys
from itertools import combinations

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline





n, *d = map(int, read().split())
ans = 0

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

print(ans)

Solution (Python):
import sys
from itertools import combinations

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline


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

ans = 0

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

print(ans)

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

s = 0
for i in range(0, n - 1):
    s += power[i] * sum(power[i + 1 : n])
print(s)

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

p = itertools.combinations(d, 2)
ans = 0
for i, j in p:
    ans += i * j
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()))
sm = sum(d)
sqsm = sum([d[i]**2 for i in range(n)])
print((sm**2-sqsm)//2)

Solution (Python):
n = int(input())
dLst = list(map(int, input().split()))
dLst.sort()
ans = 0
for i in range(n):
    for ii in range(i, n):
        if i < ii:
            ans += dLst[i] * dLst[ii]
print(ans)

Solution (Python):
n = int(input())
dLst = list(input().split())
dLst.sort()
ans = 0
for i in range(n):
    for ii in range(i, n):
        if i < ii:
            ans += int(dLst[i]) * int(dLst[ii])
print(ans)

Solution (Python):
N = int(input())
d = [int(i) for i in 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()))
c = 0

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

print(c//2)