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

a = 0
for i in range(n):
    a += d[i]**2
    
b = 0
for j in range(n):
    for k in range(n):
        b += d[j]*d[k]
        
ans = int((b-a)/2) 
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(i) for i in 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):
def solve():
    data = read()
    result = think(data)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n)

def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(data):
    n = len(data)
    total = 0
    for i in range(n):
        for j in range(i + 1, n):
            total += data[i] * data[j]
    return total


def write(result):
    print(result)


if __name__ == '__main__':
    
    
    
    
    solve()

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

Solution (Python):
import sys
from fractions import gcd
from functools import reduce
from itertools import combinations
from random import random

import numpy as np

sys.setrecursionlimit(200000)


class Solver:
    def __init__(self):
        pass

    def input(self):
        """
            faster input function than builtin stdin.
        """
        return sys.stdin.readline()[:-1]

    def ii(self, t: type = int):
        """
            input single value.
        """
        return t(self.input())

    def il(self, t: type = int):
        """
            input single line.
        """
        return list(map(t, self.input().split()))

    def imi(self, N: int, t: type = int):
        return [self.ii(t) for _ in range(N)]

    def iml(self, N: int, t: type = int):
        return [self.il(t) for _ in range(N)]

    def solve(self):
        N = self.ii()
        d = self.il()
        ans = 0
        for x, y in combinations(d, 2):
            ans += x * y
        return ans


if __name__ == "__main__":
    solver = Solver()
    print(solver.solve())

Solution (Python):
def read():
    N = int(input().strip())
    D = list(map(int, input().strip().split()))
    return N, D

def solve(N, D):
    s = 0
    for i in range(N):
        for j in range(i+1, N):
            s += (D[i] * D[j])
    return s

if __name__ == '__main__':
    inputs = read()
    print("%d" % solve(*inputs))

Solution (Python):

import itertools

N = int(input().split()[0])
d_list = list(map(int, input().split()))
p_gen = itertools.combinations(d_list, 2)
total = 0
for p in p_gen:
    a, b = p
    total += a * b
ans = total
print(ans)

Solution (Python):
N = int(input())
d = list(map(int, 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):
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(i+1, N):
        ans += D[i]*D[j]

print(ans)

Solution (Python):
import sys
import itertools
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
d = IL()

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

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

ans=0

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

Solution (Python):
from sys import stdin
import itertools
N = int(stdin.readline().rstrip())
D = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
for i in list(itertools.combinations(D,2)):
    ans += (i[0]*i[1])
print(ans)

Solution (Python):


import sys
from itertools import combinations

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = MAP()
A = LIST()

ans = 0
for a, b in combinations(A, 2):
    ans += a * b
print(ans)

Solution (Python):
import itertools
n,*d=map(int,open(0).read().split())
print(sum(a*b for a,b in itertools.combinations(d, 2)))

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

print(s)

Solution (Python):
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)

def main():
    N = int(input())
    D = [int(c) for c in input().split()]
    num = 0
    for i in range(len(D)):
        for j in range(i + 1, len(D)):
            num += D[i] * D[j]
    print(num)
    
            
        


if __name__ == '__main__':
    main()

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

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

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

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

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

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

Solution (Python):
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy




def main():
    n = int(input())
    dd = list(map(int, input().split()))
    ans = 0
    for x,y in combinations(dd,2):
        ans += x*y
    print(ans)

if __name__ == '__main__':
    main()

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

Solution (Python):
n = int(input())
l = list(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):
    for j in range(i+1,N):

        ans+=(D[i]*D[j])

print(ans)

Solution (Python):
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
N = I()
ans = int(0)
d = LI()

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 = 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 itertools

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

N = INT()
D = LIST()
sumv = 0
for i in itertools.combinations(D, 2):
    sumv += i[0] * i[1]
print(sumv)

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

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

print(res)

Solution (Python):
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    D = string_to_int(inputs[0])
    sum_good = 0

    for i, d in enumerate(D):
        for j in range(i + 1, len(D)):
            sum_good += D[i] * D[j]
    return sum_good


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)

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 // 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())
array = list(map(int, input().split()))
ans = 0
for i in range(N):
    for k in range(i+1,N):
        ans += array[i] * array[k]
print(ans)

Solution (Python):
from sys import stdin

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0

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

print(ans)

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

Solution (Python):



def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n = ri()
    ld = rli()
    ans = 0
    for i in range(len(ld)):
        for j in range(len(ld)):
            if j <= i:
                continue
            ans += ld[i]*ld[j]
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n = int(input())
    d_s = list(map(int, input().split(' ')))

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd


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


def INT(): return int(input())


def MAP(): return map(int, input().split())


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


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    n = INT()
    d = LIST()

    ans =  0

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

    print(ans)
    
if __name__ == '__main__':
    main()

Solution (Python):
from itertools import combinations as com
N = int(input())
ds = list(map(int, input().split()))
total = 0
for x, y in com(ds, 2):
    total += x*y
print(total)

Solution (Python):
N = int(input())
d = list(map(int, 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=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(i + 1, N):
        ans += d[i] * d[j]

print(ans)

Solution (Python):
from itertools import combinations

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

sum_ = 0
for x, y in combinations(dlist, 2):
    sum_ += x * y

print(sum_)

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

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

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

print(res)

Solution (Python):
from itertools import combinations

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

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

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

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

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

d_sum = sum(d)
q_sum = 0
for i in range(n):
    q_sum += d[i]**2

print((d_sum**2-q_sum)//2)

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

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

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

print(soma)

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

Solution (Python):
if __name__ == '__main__':
    N = int(input())
    d = list(map(int, input().split()))
    res = 0
    for i, di in enumerate(d[:-1]):
        for j in d[i+1:]:
            res += di * j
    print(res)

Solution (Python):
def main():
    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)
if __name__ == "__main__":
    main()

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

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

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

ans = 0

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

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())

def main():
    N = ii()
    d = lmis()
    print(sum(d[i]*d[j] for i in range(N) for j in range(i+1, N)))

main()

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

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

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):
        if i == j:
            continue
        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):
from itertools import combinations
n = int(input())
l = [int(x) for x in input().split()]
l1 = list(combinations(l, 2))
c = 0
for i in l1:
	c += i[0]*i[1]
print(c)

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

result = 0
for a in range(N):
    for b in range(a+1, N):
        result += arr[a]*arr[b]

print(result)

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


if __name__ == "__main__":
    main()

Solution (Python):



def rint():
    return int(input())


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


n = rint()
d = rints()
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())
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 math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

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

Solution (Python):
import itertools

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

ans = 0

for i, j in itertools.combinations(d, 2):
    ans += i * j

print(ans)

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

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

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

ret = 0
total = sum(D)

for i in range(N):
	ret += D[i] * (total - D[i])
	
print(int(ret / 2))

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

result = 0

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

print(result)

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

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

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






def main():

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






if __name__ == "__main__":
    main()

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

Solution (Python):
import sys


def main():
    n = int(sys.stdin.readline().strip())
    d = [int(s) for s in sys.stdin.readline().strip().split()]

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



main()

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

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):
input()
D=list(map(int,input().split()))
s=sum(D)
ss=sum(d**2 for d in D)
print((s**2-ss)//2)

Solution (Python):
def main():

    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]
    return ans

if __name__ == '__main__':
    print(main())

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

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

print(dsum)

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

ans = 0
for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        ans += d_array[i] * d_array[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()))

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

print(res)

Solution (Python):

import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def warshall_floyd(d):
    
    n = len(d)
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

def solve():
    N = II()
    d_list = LI()

    from itertools import combinations

    sm = 0
    for comb in combinations(d_list, 2):
        sm += comb[0] * comb[1]

    print(sm)


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

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

print(sums)

Solution (Python):

import sys

def solve():
  n = int(input())
  d = list(int(i) for i 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//2)
solve()

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

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

Solution (Python):
import sys; readline = sys.stdin.readline
from collections import deque


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

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

Solution (Python):
def main():
    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)    
    
if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

print((sum(a) ** 2 - sum((i ** 2 for i in a))) // 2)

Solution (Python):
N = int(input())
d_list = [int(x) for x in input().split()]
ans = 0
for i, di in enumerate(d_list):
    for dj in d_list[i+1:]:
        ans += di * dj
print(ans)

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

print(ans)

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

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

print(x)

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

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

print(ans)

Solution (Python):


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

output = 0

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

print(output)

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

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

print(res)

Solution (Python):
import itertools

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

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

ans = 0
for i in c:
    ans += i[0]*i[1]

print(ans)

Solution (Python):
n=int(input())
ans=0
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()))
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(int(ans/2))

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

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
d = LIST()

ans = 0

for i, j in list(combinations(range(N), 2)):
	ans += d[i] * d[j]
print(ans)

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

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

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

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

rtn //= 2
print(rtn)

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


sum = 0
for i in range(n):
    for j in range(i):
        sum += dlist[i] * dlist[j]

print(sum)

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

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)