CodeEff/ECCO huggingface dataset:
# Original solution
from collections import defaultdict
from itertools import accumulate

N,M=list(map(int,input().split()))
A=list(map(int,input().split()))

acc=list(accumulate(A))

d=[defaultdict(int) for i in range(N+1)]

for i in range(N):
    d[i+1][acc[i]%M]+=1
    for n,m in list(d[i].items()):
        d[i+1][n]+=m

ans=0
for g in range(N):
    if acc[g]%M==0:
        ans+=d[g+1][acc[g]%M]
    else:
        ans+=d[g+1][acc[g]%M]-1
print(ans)

# Optimized solution
from collections import defaultdict
from itertools import accumulate

N,M=list(map(int,input().split()))
A=list(map(int,input().split()))

acc=list(accumulate(A))

d=defaultdict(int)

ans=0
for i in range(N):
    if acc[i]%M==0:
        d[acc[i]%M]+=1
        ans+=d[acc[i]%M]
    else:
        d[acc[i]%M]+=1
        ans+=d[acc[i]%M]-1
print(ans)
# Original solution
N,M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

stim_A = [0]
for ind,i in enumerate(A):
    stim_A.append((stim_A[-1]+i)%M)

ans = 0
for ind,i in enumerate(stim_A[1:]):
    ans += 1 if i==0 else 0
    ans += stim_A[1:ind+1].count(i)
print(ans)

# Optimized solution
N,M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

stim_A = [0]
di = {}
ans = 0
for i in A:
    stim_A.append((stim_A[-1]+i)%M)
    if(stim_A[-1] in di):
        di[stim_A[-1]] += 1
    else:
        di[stim_A[-1]] = 1
for i in di:
    if(i==0):
        ans+=di[0]
    if(di[i]>1):
        ans += (di[i]-1)*di[i]//2
    
print(ans)
# Original solution

def cal_comb(n,r):
    ret = 1
    for i in range(1,n+1):
        ret *= i
    for i in range(1,n-r+1):
        ret //= i
    for i in range(1,r+1):
        ret //= i
    return ret


N,M = list(map(int,input().split()))
L = list(map(int,input().split()))

from itertools import accumulate
accumulated =  [0]+list(accumulate(L))
accumulated = [x%M for x in accumulated]
def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c = counter(accumulated)
ans = 0
for x in c:
    ans += cal_comb(x[1],2)

print(ans)



# Optimized solution



N,M = list(map(int,input().split()))
L = list(map(int,input().split()))

from itertools import accumulate
accumulated =  [0]+list(accumulate(L))
accumulated = [x%M for x in accumulated]
def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c = counter(accumulated)
ans = 0
for x in c:
    ans += x[1] * (x[1]-1) //2

print(ans)
# Original solution
n,m=list(map(int, input().split()))
a=list(map(int,input().split())) 
b=[sum(a[0:i]) for i in range(1,n+1)]
c=[b[i]%m for i in range(n)]
ans=0
import collections
k=list(collections.Counter(c).items())
for x in k:
    j=True
    if x[0]==0:
        ans+=x[1]*(x[1]+1)//2
        j=False
    if x[1]>1 and j:
        ans+=(x[1]-1)*x[1]//2
print(ans)

# Optimized solution
n,m=list(map(int, input().split()))
a=list(map(int,input().split())) 
b=[a[0]]
for i in range(1,n):
    b.append(b[-1]+a[i])
c=[b[i]%m for i in range(n)]
ans=0
import collections
k=list(collections.Counter(c).items())
for x in k:
    j=True
    if x[0]==0:
        ans+=x[1]*(x[1]+1)//2
        j=False
    if x[1]>1 and j:
        ans+=(x[1]-1)*x[1]//2
print(ans)
# Original solution
def d_candy_distribution(N, M, A):
    import itertools
    import collections
    b = [0] + list(itertools.accumulate(A))

    # Aの累積和のうち、Mで割った余りが等しい要素の個数
    remainders = collections.defaultdict(int)
    for t in b:
        remainders[t % M] += 1

    ans = 0
    for k, v in list(remainders.items()):
        if v >= 2:
            # 余りが等しい要素が2個以上あるなら、それから2つ選んで要望を満たせる
            ans += v * (v - 1) // 2
    return ans

N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
print((d_candy_distribution(N, M, A)))

# Optimized solution
def d_candy_distribution(N, M, A):
    import itertools
    import collections
    # Aの累積和のうち、Mで割った余りが等しい要素の個数
    remainders = collections.defaultdict(int)
    for t in [0] + list(itertools.accumulate(A)):
        remainders[t % M] += 1
    # 余りが等しい要素が2個以上あるなら、それから2つ選んで要望を満たせる
    return sum([v * (v - 1) // 2 for v in list(remainders.values()) if v >= 2])

N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
print((d_candy_distribution(N, M, A)))
# Original solution
n, m = list(map(int, input().split()))
lst = list(map(int, input().split()))
imod = []
for i in range(n):
    imod = imod + [sum(lst[0:i]) % m]
imod = imod + [sum(lst) % m]
s = 0
for i in range(n):
    for j in range(i+1,n+1):
        if imod[i] == imod[j]:
            s = s + 1
print(s)

# Optimized solution
n, m = list(map(int, input().split()))
lst = list(map(int, input().split()))
dp = {}
dp[0] = 1
a, s = 0, 0
for i in lst:
    a += i
    a %= m
    if a in dp:
        s += dp[a]
        dp[a] += 1
    else:
        dp[a] = 1
print(s)
# Original solution
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
from collections import Counter
c=Counter()
sm=0
c[sm]+=1
for i in range(n):
  sm+=a[i]
  c[sm%m]+=1
ans=0
for v in list(c.values()):
  ans+=v*(v-1)//2
print(ans)


# Optimized solution
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))

from collections import Counter
c=Counter()
s=0
c[s]+=1
for i in range(n):
  s+=a[i]
  c[s%m]+=1

ans=0
for v in list(c.values()):
  ans+=v*(v-1)//2
print(ans)
# Original solution
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))

from collections import Counter
c=Counter()
s=0
c[s]+=1
for i in range(n):
  s+=a[i]
  c[s%m]+=1

ans=0
for v in list(c.values()):
  ans+=v*(v-1)//2
print(ans)


# Optimized solution
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
from collections import Counter
c = Counter()
sum_val = 0
c[sum_val] += 1
for i in range(n):
    sum_val += a[i]
    sum_val %= m
    c[sum_val] += 1
ans = 0
for v in list(c.values()):
    ans += v*(v-1)//2
print(ans)
# Original solution
numBox, numnClild = [int(i) for i in input().split()]
numCandies = [int(i) for i in input().split()]

def find(left):
    acc = 0
    for i in range(left, numBox):
        acc += numCandies[i]
        if acc % numnClild == 0:
            return i + 1
    return -1

done_list = []
count = 0
for left in range(0, numBox):
    tmp_count = 0
    right = left
    while right != -1:
        right = find(right)
        if right != -1:
            if right in done_list:
                break
            else:
                done_list.append(right)
                tmp_count += 1
    count += int(tmp_count * (tmp_count + 1) / 2)
print(count)

# Optimized solution
numBox, numClild = [int(i) for i in input().split()]
numCandies = [int(i) for i in input().split()]

subsequences = {}
acc = 0
for i in range(0, numBox):
    acc += numCandies[i]
    if (acc % numClild) in subsequences:
        subsequences[acc % numClild].append(i)
    else:
        subsequences[acc % numClild] = [i]

count = 0
for k, v in list(subsequences.items()):
    count += int(len(v) * (len(v) - 1) / 2)
    if k == 0:
        count += len(v)
print(count)
# Original solution

def main():
    N, M = [int(n) for n in input().split()]
    A = [int(n) for n in input().split()]
    B = [0]*(N+1)
    B[0] = 0
    d = {}
    accum = 0
    for i in range(N+1):
        B[i] = accum
        if i != N:
            accum += A[i]
    
    for i, b in enumerate(B):
        x = b % M
        if x in list(d.keys()):
            d[x] += 1
        else:
            d[x] = 1
    # print(B)
    print((sum([i * (i - 1)//2 for i in list(d.values())])))
        
# import os,sys, time

# current = os.path.abspath(__file__ + "/..")+"/"
# fdr = open(current + "d-case1.txt", "r")
# sys.stdin = fdr
# t = time.time()
# main()
# print(time.time() - t)

main()


# Optimized solution

def main():
    N, M = [int(n) for n in input().split()]
    A = [int(n) for n in input().split()]
    B = [0]*(N+1)
    B[0] = 0
    d = {}
    accum = 0
    for i in range(N+1):
        B[i] = accum
        if i != N:
            accum += A[i]
    
    for i, b in enumerate(B):
        x = b % M
        if x in list(d.keys()):
            d[x] += 1
        else:
            d[x] = 1
    # print(B)
    print((sum([i * (i - 1)//2 for i in list(d.values())])))
        
# import os,sys, time

# current = os.path.abspath(__file__ + "/..")+"/"
# fdr = open(current + "d-case1.txt", "r")
# sys.stdin = fdr
# t = time.time()
# main()
# print(time.time() - t)
if __name__ == "__main__":
    main()
# Original solution
from collections import Counter

n, m = list(map(int, input().split()))
A = [int(i) for i in input().split()]

A[0] %= m
for i in range(n - 1):
    A[i + 1] += A[i]
    A[i + 1] %= m
    
C = Counter(A)
ans = 0

for k, v in list(C.items()):
    if k == 0:
        ans += v
    if v >= 2:
        ans += v * (v - 1) // 2
        
print(ans)

# Optimized solution
from collections import Counter

n, m = list(map(int, input().split()))
A = [int(i) for i in input().split()]

A[0] %= m
for i in range(n-1):
    A[i+1] += A[i]
    A[i+1] %= m
    
C = Counter(A)
ans = 0
for k, v in list(C.items()):
    if k == 0:
        ans += v
    if v >= 2:
        ans += (v * (v-1)) // 2
        
print(ans)
# Original solution
from collections import Counter
N, M = list(map(int, input().split()))
A = [0] + [int(i) for i in input().split()]

for i in range(N):
    A[i + 1] += A[i]
    A[i + 1] %= M
    
def comb(n, k):
    k = min(k, n - k)
    result = 1
    for i in range(n, n - k, -1):
        result *= i
    for i in range(1, k + 1):
        result //= i 
    return result

ans = 0
for i in list(Counter(A).values()):
    if i > 1:
        ans += comb(i, 2)

print(ans)

# Optimized solution
from collections import Counter
N, M = list(map(int, input().split()))
A = [0] + [int(i) for i in input().split()]

for i in range(N):
    A[i + 1] += A[i]
    A[i + 1] %= M

ans = 0
for i in list(Counter(A).values()):
    if i > 1:
        ans += i * (i - 1) // 2

print(ans)
# Original solution
import itertools
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
acc = itertools.accumulate(A)
acc = [e % M for e in acc]
cnt_dict = {}
ans = 0
for e in acc:
    if e == 0:
        ans += 1
    if e in cnt_dict:
        cnt_dict[e] += 1
    else:
        cnt_dict[e] = 0
    ans += cnt_dict[e]
print(ans)

# Optimized solution
def main():
    import itertools
    N,M = list(map(int,input().split()))
    A = list(map(int,input().split()))
    acc = itertools.accumulate(A)
    acc = [e % M for e in acc]
    cnt_dict = {}
    ans = 0
    for e in acc:
        if e == 0:
            ans += 1
        if e in cnt_dict:
            cnt_dict[e] += 1
        else:
            cnt_dict[e] = 0
        ans += cnt_dict[e]
    print(ans)

main()
# Original solution
n,m,*c=open(0).read().split();d={0:1};r=s=0
for i in c:s+=int(i);s%=int(m);x=d.get(s,0);r+=x;d[s]=x+1
print(r)

# Optimized solution
n,m,*c=list(map(int,open(0).read().split()));d={0:1};r=s=0
for i in c:s+=i;s%=m;x=d.get(s,0);r+=x;d[s]=x+1
print(r)
# Original solution
N = int(eval(input()))
x = N * 800
y = (N // 15) * 200
print((x-y))

# Optimized solution
N = int(eval(input()))
print((N*800-N//15*200))
# Original solution
meals = int(eval(input()))

print((800 * meals - meals // 15 * 200))


# Optimized solution
unit_price = 800
reward_money = 200

meals = int(eval(input()))

print((unit_price * meals - meals // 15 * reward_money))
# Original solution
n = int(eval(input()))
ans = n * 800 - n//15 * 200
print (ans)

# Optimized solution
n = int(eval(input()))
x = 800*n
y = int(n/15)
print((x-200*y))
# Original solution
# A - Restaurant
n = int(eval(input()))
print((800 * n - n // 15 * 200))

# Optimized solution
# ABC 055: A – Restaurant
n = int(eval(input()))
print((n * 800 - n // 15 * 200))
# Original solution
n = int(eval(input()))
x = n * 800
y = (n // 15) * 200
print((x - y))

# Optimized solution
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")


def main():
    n = int(eval(input()))
    x = n * 800
    y = (n // 15) * 200
    print((x - y))


if __name__ == '__main__':
    main()
# Original solution
x = int(eval(input()))

ans =( 800*x) - ((x//15)*200)

print( ans)

# Optimized solution
n = int(eval(input()))
x = n*800
y = 200*(n//15)
print((x-y))
# Original solution
n = int(eval(input()))

if n >= 15:
    x = n * 800
    y =( n // 15 ) * 200
    answer = x - y
    print(answer)
else:
    answer = n * 800
    print(answer)

# Optimized solution
n = int(eval(input()))

if n >= 15:
    x = n * 800
    y = ( n // 15 ) * 200
    print((x - y))
else:
    print((n * 800))
# Original solution
n = int(eval(input()))

if n >= 15:
    x = n * 800
    y = ( n // 15 ) * 200
    print((x - y))
else:
    print((n * 800))

# Optimized solution
n = int(eval(input()))

if n >= 15:
    print((n * 800 - ( n // 15 ) * 200))
else:
    print((n * 800))
# Original solution
n = int(eval(input()))
x = n * 800
y = (n // 15) * 200
print((x - y))

# Optimized solution
def main():
    N = int(eval(input()))
    prices = N * 800
    discount = (N // 15) * 200
    print((prices - discount))

if __name__ == '__main__':
    main()
# Original solution
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    n = I()
    print((n*800-200*(n//15)))

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

def J():
    return

def K():
    return

#Solve
if __name__ == "__main__":
    A()


# Optimized solution
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    x = n*800
    y = (n//15)*200
    print((x-y))
    return

#Solve
if __name__ == "__main__":
    solve()
# Original solution
from collections import defaultdict


def main():
    n = int(eval(input()))
    print((n * 800 - 200 * (n // 15)))


if __name__ == '__main__':
    main()


# Optimized solution
from collections import defaultdict


def main():
    N = int(eval(input()))
    print((800 * N - (N // 15) * 200))


if __name__ == '__main__':
    main()
# Original solution
n=int(eval(input()))
print((n*800-200*(n//15)))

# Optimized solution
n=int(eval(input()))
print((n*800-n//15*200))
# Original solution
#   AtCoder abc055 a

#   入力
n = int(eval(input()))

#   処理
total_pay = n * 800
total_back = (n // 15) * 200
balance = total_pay - total_back
#   出力
print(balance)



# Optimized solution
#   AtCoder abc055 a

#   入力
n = int(eval(input()))

#   処理
# total_pay = n * 800
# total_back = (n // 15) * 200
# balance = total_pay - total_back
#   出力
print(((n * 800) - ((n // 15) * 200)))
# Original solution
n=int(eval(input()))
x,y=n*800,n//15*200
print((x-y))

# Optimized solution
n=int(eval(input()))
print((n*800-n//15*200))
# Original solution
N = int(eval(input()))
x = N*800
y = (N//15)*200
print((x-y))

# Optimized solution
N = int(eval(input()))
x = 800*N
y = (N//15)*200
print((x-y))
# Original solution
N = int(eval(input()))
x = 800*N
y = (N//15)*200
print((x-y))

# Optimized solution
N = int(eval(input()))
a = N//15
print((N*800-a*200))
# Original solution
N = int(eval(input()))
print((800 * N - N // 15 * 200))

# Optimized solution
print(((lambda N: 800 * N - N // 15 * 200)(int(eval(input())))))
# Original solution
N = int(eval(input()))
print((800*N-(N//15)*200))

# Optimized solution
# coding: utf-8

N = int(eval(input()))
ans = 800*N - N//15*200
print(ans)
# Original solution
n=int(eval(input()));print((n*800-n//15*200))

# Optimized solution
n=int(eval(input()));print((int(40/3*(n*59+n%15))))
# Original solution
a=int(eval(input()))
print((a*800-200*(a//15)))

# Optimized solution
a=int(eval(input()))
print((a*800-a//15*200))
# Original solution
import sys
from collections import defaultdict, deque, Counter
import math
 
# import copy
from bisect import bisect_left, bisect_right
# import heapq
 
# sys.setrecursionlimit(1000000)
 
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]
 
INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)
 
def search(pros,tgt,g,d):
    tmp = 0
    cnt = 0
    rest = []
    for i in range(d):
        if tgt % 2 == 1:
            tmp += 100 * (i+1) * pros[i][0] + pros[i][1]
            cnt += pros[i][0]
        else:
            rest.append((i+1,pros[i][0]-1))
        tgt //= 2
    # print(tmp)
    if tmp >= g:
        return cnt
    for ap, ac in rest[::-1]:
        if tmp + 100 * ap * ac >= g:
            cnt += math.ceil((g - tmp)/(100 * ap))
            return cnt
        else:
            cnt += ac
            tmp += 100 * ac * ap

    return INF

def main():

    n = getN()
    x = 800 * n
    y = 200 * (n // 15)
    print((x-y))

 
if __name__ == "__main__":
    main()
   

# Optimized solution
import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def solve():

    n = getN()
    x = n * 800
    y = (n // 15) * 200
    print((x - y))

def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()
# Original solution
N = int(eval(input()))

x = N*800
y = (N//15)*200
print((x-y))

# Optimized solution
N = int(eval(input()))
x = 800*N
y = (N//15)*200
print((x-y))
# Original solution
n = int(eval(input()))
print(((n * 800) - (n // 15 * 200)))

# Optimized solution
N = int(eval(input()))
print((N * 800 - N // 15 * 200))
# Original solution
def ii():return int(eval(input()))
def iim():return list(map(int,input().split()))
def iil():return list(map(int,input().split()))
def ism():return list(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):
#        print(i,j)
        ans += D[i]*D[j] 
print(ans)

# Optimized solution
def ii():return int(eval(input()))
def iim():return list(map(int,input().split()))
def iil():return list(map(int,input().split()))
def ism():return list(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))
# Original solution
N = int(eval(input()))
d = input().split()

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

# Optimized solution
N = int(eval(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)
# Original solution
#!/usr/bin/env python3
n, *d = list(map(int, open(0).read().split()))
s = sum(d)
print((sum((s - i) * i for i in d)//2))


# Optimized solution
n,*d = list(map(int,open(0).read().split()))
print((sum((sum(d)-i)*i for i in d)//2))
# Original solution
N = int(eval(input()))
d = list(map(int, input().split()))
cal = 0
for i in range(0, N):
    for j in range(0 , N):
        if i != j:
            cal += d[j] * d[i]
print((int(cal / 2))) 

# Optimized solution
N = int(eval(input()))
d = list(map(int, input().split()))
cal = sum([d[j] * d[i] for i in range(N) for j in range(N) if i != j ])
print((int(cal / 2)))
# Original solution
import sys
import itertools
input = lambda: sys.stdin.readline().rstrip()


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

    comb = list(itertools.combinations(list(range(N)), 2))
    ans = 0
    for c in comb:
        i1, i2 = c
        ans += d[i1] * d[i2]

    print(ans)


if __name__ == '__main__':
    solve()


# Optimized solution
import sys
import itertools
input = lambda: sys.stdin.readline().rstrip()


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

    ruiseki = list(itertools.accumulate(d))
    ans = 0
    for i in range(N - 1):
        ans += d[i] * (ruiseki[N - 1] - ruiseki[i])

    print(ans)


if __name__ == '__main__':
    solve()
# Original solution
n = int(eval(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))

# Optimized solution
n = int(eval(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)
# Original solution
from itertools import accumulate
n = int(eval(input()))
d = list(map(int, input().split()))
print((sum(a*b for a, b in zip(d[1:], accumulate(d)))))

# Optimized solution
from itertools import accumulate as Z
n = eval(input())
d = list(map(int,input().split()))
print((sum(a*b for a,b in zip(d[1:],Z(d)))))
# Original solution
import itertools
N = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
for x, y in itertools.combinations(d,2):
    ans += x * y
print(ans)

# Optimized solution
N = int(eval(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)
# Original solution
N = int(eval(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)

# Optimized solution
N = int(eval(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)
# Original solution
A = eval(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)

# Optimized solution
#abc143_b.py
N = int(eval(input()))
D = list(map(int,input().split()))
ans = 0
for i in range(N):
    for j in range(i,N):
        if i!=j:
            ans += D[i]*D[j]
print(ans)
# Original solution
import itertools
import operator


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

n = N * (N - 1) // 2
l = []
c = list(itertools.combinations(d, 2))
for i in range(n):
    l.append(operator.mul(c[i][0], c[i][1]))
ans = sum(l)
print(ans)

# Optimized solution
import itertools


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

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