CodeEff/ECCO huggingface dataset:
# Original solution
#!/usr/bin/env python3

# from typing import Optional
# from typing import List
# from typing import Dict
# from typing import Tuple
# from typing import Sequence


def main():
    N = int(eval(input()))
    A = list([int(x) for x in input().split()])

    sum = 0
    mod = 1000000000 + 7
    for i in range(N - 1):
        for j in range(i + 1, N):
            sum += A[i] * A[j]
            sum = sum % mod

    print(sum)


if __name__ == "__main__":
    main()


# Optimized solution
#!/usr/bin/env python3

# from typing import Optional
# from typing import List
# from typing import Dict
# from typing import Tuple
# from typing import Sequence


def main():
    N = int(eval(input()))
    A = list([int(x) for x in input().split()])

    sum = 0
    mod = 1000000000 + 7

    sumJ = 0
    for j in range(N):
        sumJ += A[j]

    for i in range(N - 1):
        sumJ -= A[i]
        sum += A[i] * sumJ
        sum = sum % mod

    print(sum)


if __name__ == "__main__":
    main()
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
MOD = 10**9+7
ans = 0
def dfs(A, start):
    global ans
    if len(A) == 2:
        ans += ((A[0]*A[1])%MOD)
        return
    else:
        for i in range(start, len(a)):
            A.append(a[i])
            dfs(A, i+1)
            A.pop()

dfs([], 0)
print((ans%MOD))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
MOD = 10**9+7
acc = [0]
ans = 0
for i in a:
    acc.append(acc[-1]+i)
acc = acc[1:]
for i, v in enumerate(a):
    ans += (v*(acc[-1]-acc[i]))%MOD
print((ans%MOD))
# Original solution
n = int(eval(input()))
x = list(map(int, input().split()))
sum = 0
for i in range(n):
  for j in range(i):
    sum += x[i]*x[j]
print((sum % (pow(10,9)+7)))

# Optimized solution
n = int(eval(input()))
lst = list(map(int, input().split()))
s = (sum(lst)**2 - sum([z**2 for z in lst]))//2
print((s % (pow(10,9)+7)))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
#mod_a = [i%(10**9 + 7) for i in a]
res = 0
for i in range(0, len(a)-1):
  for j in range(i+1, len(a)):
    res += (a[i]*a[j])%(10**9 + 7)
print((res%(10**9 + 7)))



# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
#mod_a = [i%(10**9 + 7) for i in a]
res = 0
sum_a = sum(a)
b = 0
t = 0
for i in range(0, len(a)-1):
  t = a[i]
  b += a[i]
  res += (sum_a - b)*t%(10**9 + 7)
print((res%(10**9 + 7)))
# Original solution
from itertools import product, combinations

n = int(eval(input()))

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

result = 0

for x, y in combinations(a, 2):
	result += x * y

print((result % (10 ** 9 + 7)))

# Optimized solution
from itertools import accumulate

MOD = 10 ** 9 + 7

n = int(eval(input()))

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

suffix_sum = list(accumulate(a[::-1]))[::-1]

req_arr = [x -  y for x, y in zip(suffix_sum, a)]

result = sum([(x * y) % MOD for x, y in zip(req_arr, a)])

print((result % MOD))
# Original solution
n = int(eval(input()))
S = [int(a) for a in input().split()]
divisor = 10**9 + 7
tot = 0
a,b = 0,0
for i in range(n-1):
  #b = 0
  b = sum(S[i+1:n]) % divisor
  #for j in range(i+1,n):
  #  b += S[j]
  #  if b >= divisor:
  #    b = b % divisor
  a = S[i]
  #tot += multmod(a,b,divisor)
  tot += a*b % divisor
  #if tot >= divisor:
  #  tot = tot % divisor

tot = tot % divisor
print(tot)

# Optimized solution
def multmod(a,b,m):
  ans = 0
  a = a % m
  
  while b:
    if (b & 1): # odd
      ans = (ans + a) % m
    
    a = (2 * a) % m
    b >>= 1 # b = b / 2
    
  return ans

n = int(eval(input()))
S = [int(a) for a in input().split()]
divisor = 10**9 + 7
tot = 0
a,b = 0,0
arr_sum = sum(S) #% divisor
arr_ssq = arr_sum*arr_sum #% divisor
isq_sum = 0
for i in range(n):
  isq_sum += S[i]*S[i] #% divisor
  
#isq_sum = isq_sum % divisor
tot = (arr_ssq - isq_sum)//2 % divisor

print(tot)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
P = 10**9+7
ans = 0

for i in range(N):
    temp = 0
    for j in range(i+1,N):
        temp += A[j]
    temp *= A[i]
    ans += temp%P
print((ans%P))

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
P = 10**9+7
ans = 0
S = sum(A)

for i in range(N):
    S -= A[i]
    ans += A[i]*S%P
print((ans%P))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

s = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        s += a[i] * a[j]
        s %= 10 ** 9 + 7

print(s)

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

s = 0
for i in range(n):
    s += a[i]

tr = 0
for i in range(n):
    tr += a[i] ** 2

a2 = s ** 2 - tr
a = a2 // 2
a %= 10 ** 9 + 7

print(a)
# Original solution
if __name__ == '__main__':
    n = int(eval(input()))
    a = [int(i) for i in input().split()]
    mod = 10**9+7
    count = 0

    for i in range(n-1):
        for j in range(i+1,n):
            count += (a[i]*a[j])%mod
    print((count%mod))



# Optimized solution
if __name__ == '__main__':
    n = int(eval(input()))
    a = [int(i) for i in input().split()]
    mod = 10**9+7
    sumA = sum(a)
    sumB = 0
    count = 0

    for i in range(n-1):
        sumB+=a[i]
        count += ((sumA-sumB)*a[i])%mod
    print((count%mod))
# Original solution
# -*- coding: utf-8 -*-
N = int(eval(input()))
A = input().split()

sum = 0
for i in range(N):
    count = 0
    for j in range(i+1, N):
        count += int(A[j])
    sum += int(A[i]) * count

print((sum % (10**9 + 7)))


# Optimized solution
# -*- coding: utf-8 -*-
N = int(eval(input()))
A = input().split()

B = [0]
for i in range(N):
    B.append(B[i] + int(A[i]))

sum = 0
for i in range(N):
    sum += int(A[i]) * (B[N] - B[i+1])

print((sum % (10**9 + 7)))
# Original solution
N = int(eval(input()))
ls = list(map(int, input().split()))
m = 1000000007
ans = 0
for i in range(0, N):
    for j in range(i+1, N):
        ans += (ls[i]*ls[j])
print((ans%m))

# Optimized solution
N = int(eval(input()))
ls = list(map(int, input().split()))
m = 1000000007
sumNum = sum(ls)
currentSum, lastAns = 0, 0
for i in range(N -1):
    currentSum += ls[i]
    lastAns = (lastAns + (ls[i] * (sumNum - currentSum))) % m
print(lastAns)
# Original solution
N = int(eval(input()))

A = list(map(int, input().split()))
sum = 0
for i in range(N-1):
    for m in range(i+1, N):
        sum += A[i]*A[m]
        if sum > 1000000007:
            sum = sum%1000000007


print(sum)

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

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

ans = ans % (10 ** 9  +7)        

print(ans)
# Original solution
n = int(eval(input()))
A = list(map(int,input().split()))
MOD = 10 ** 9 + 7
ret = 0
for i in range(n-1):
  for j in range(i+1,n):
    ret += ((A[i] %MOD) * A[j]) % MOD
    ret = ret % MOD
print(ret)

# Optimized solution
n = int(eval(input()))
A = list(map(int,input().split()))
MOD = 10 ** 9 + 7
ret = 0
S = [A[0]]
for i in range(1, n):
  S.append(S[i-1] +A[i])

for i in range(n):
  ret += A[i] * (S[-1]-S[i])
  ret = ret % MOD
print(ret)
# Original solution
import itertools

n = int(eval(input()))
a_list = list(map(int, input().split()))
max = 0
mod = 10 ** 9 + 7

for a in itertools.combinations(a_list, 2):
    b, c = a
    max += b * c

print((max % mod))

# Optimized solution
mod = 10 ** 9 + 7
n = int(eval(input()))
a_list = list(map(int, input().split()))
result = 0
a_sum = sum(a_list)
for i in a_list:
    a_sum -= i
    result += i * a_sum
print((result % mod))
# Original solution
from sys import stdin
input = stdin.readline

n = int(input().rstrip())
a = list(map(int, input().rstrip().split()))

MOD = 1000000007
ans = 0

k = 0
s = [0] * n
for i in range(n-1, 0, -1):
    k += a[i] % MOD
    s[i] = k

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

ans = ans % MOD

print(ans)

# Optimized solution
from sys import stdin
input = stdin.readline

def cumsum(xs):
    result = [xs[0]]
    for x in xs[1:]:
        result.append(result[-1] + x)
    return result

n = int(input().rstrip())
a = list(map(int, input().rstrip().split()))

ans = 0
MOD = 1000000007
s = cumsum(list(reversed(a)))

for i in range(n-1):
    ans += a[i] * s[n-2-i]

ans = ans % MOD

print(ans)
# Original solution
from sys import stdin
input = stdin.readline

def cumsum(xs):
    result = [xs[0]]
    for x in xs[1:]:
        result.append(result[-1] + x)
    return result

n = int(input().rstrip())
a = list(map(int, input().rstrip().split()))

ans = 0
MOD = 1000000007
s = cumsum(list(reversed(a)))

for i in range(n-1):
    ans += a[i] * s[n-2-i] % MOD

ans = ans % MOD

print(ans)


# Optimized solution
from sys import stdin
input = stdin.readline

def cumsum(xs):
    result = [xs[0]]
    for x in xs[1:]:
        result.append(result[-1] + x)
    return result

n = int(input().rstrip())
a = list(map(int, input().rstrip().split()))

ans = 0
MOD = 1000000007
s = cumsum(list(reversed(a)))

for i in range(n-1):
    ans += a[i] * s[n-2-i]

print((ans % MOD))
# Original solution
n=int(eval(input()))
a = list(map(int,input().split()))
def p(val):
    print(val)

sho = 10**9 +7
count = 0
for i in range(n-1):
    for j in range(i+1,n):
        count += ((a[i]%sho)*(a[j]%sho)) % sho
        #if count > sho:
        #   count = count%sho
p(count%sho)

# Optimized solution
n=int(eval(input()))
a = list(map(int,input().split()))
def p(val):
    print(val)
 
sho = 10**9 +7
a1 = sum(a)**2
b1 = list([y**2 for y in a])
b2=sum(b1)
result = ((a1-b2)//2)% sho
p(result)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
l = []
n = 0
for i in range(1,N):
    n += A[i]*sum(A[:i])

print((n%(10**9+7)))

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
B = sum(A)
new_A = A.reverse()
n = 0
for i in range(N-1):
    n += A[i]*(B-A[i])
    B = B-A[i]

print((n%(10**9+7)))
# Original solution
import functools
import operator

N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9+7
ans = 0

for i in range(1,N):
    tmp = A[i:]
#    print(tmp)
    ans += A[i-1]*sum(tmp)
print((ans%mod))


# Optimized solution
import functools
import operator

N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9+7
ans = 0
v = sum(A)
for i in range(N-1):
    v -= A[i]
    ans += A[i]*v
print((ans%mod))
# Original solution
from sys import stdin
input = stdin.readline

def SumOfProductParis(n):
    if n == 0:
        return 0
    elif n == 1:
        return A[0]
    else:
        result = 0
        for i in range(0, n-1):
            for j in range(i+1, n):
                result += A[i]*A[j]
        return result%(10**9+7)

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

print((SumOfProductParis(N)))

# Optimized solution
from sys import stdin
input = stdin.readline

def SumOfProductParis(n):
    if n == 0:
        return 0
    elif n == 1:
        return A[0]
    else:
        result = 0
        temp = sum(A)
        result = temp**2
        for i in range(n):
            result -= A[i]**2
        return (result//2)%(10**9+7)

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

print((SumOfProductParis(N)))
# Original solution
n = int(eval(input()))
l = list(map(int,input().split()))
M = 1000000007
sm = 0
for i in range(n):
	for j in range(i+1,n):
		sm = (sm%M + (l[i] * l[j])%M) % M
print(sm)


# Optimized solution
n = int(eval(input()))
l = list(map(int,input().split()))
M = 1000000007
sm = 0
for i in l:
	sm = (sm + i)
sms = pow(sm,2)
ss = 0
for i in range(n):	
	ss = (ss + (l[i] * l[i]))
print((((sms - ss)//2)%M))
# Original solution
import sys
sys.setrecursionlimit(10**6)

n = int(eval(input()))
A = list(map(int, input().split()))
#n, m = map(int, input().split())
#s = input()
#s,t = input().split()
#a = [int(input()) for _ in range(n)]
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

MOD = 10**9+7

# tot = sum(A)

# ans = 0

# for a in A:
#     ans += a*(tot-a)
#     ans %= MOD

# ans //= 2
# ans %= MOD

ans = 0

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

print(ans)


# Optimized solution
import sys
sys.setrecursionlimit(10**6)

n = int(eval(input()))
A = list(map(int, input().split()))
#n, m = map(int, input().split())
#s = input()
#s,t = input().split()
#a = [int(input()) for _ in range(n)]
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

MOD = 10**9+7

tot = sum(A)
tot %= MOD

ans = 0
rmv = 0

for a in A:
    rmv += a
    rmv %= MOD
    ans += a*(tot-rmv)
    ans %= MOD

print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
 
s = 0
for i in range(N):
  s += A[i]
  s %= (10**9+7)
s = s**2
s %= (10**9+7)
 
t = 0
for i in range(N):
  t += (A[i]**2 % (10**9+7))
t %= (10**9+7)
 
ans = (s-t) % (10**9+7)
'''
tmp = (2**1000000005) % (10**9+7)
'''
tmp = 500000004
ans *= tmp
ans %= (10**9+7)
print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
 
s, t = 0, 0
for i in range(N):
  s += A[i]
  t += A[i]**2
s = s**2

ans = (s-t) % (10**9+7)
# tmp = (2**1000000005) % (10**9+7)
tmp = 500000004
ans = (ans*tmp) % (10**9+7)
print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
 
s, t = 0, 0
for i in range(N):
  s += A[i]
  t += A[i]**2
s = s**2

ans = (s-t) % (10**9+7)
# tmp = (2**1000000005) % (10**9+7)
tmp = 500000004
ans = (ans*tmp) % (10**9+7)
print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
 
s, t = 0, 0
for i in range(N):
  s += A[i]
  t += A[i]**2
s = s**2

# 割り算のmodを求めるため、逆元を求め、積に変換する
ans = (s-t) % (10**9+7)
# tmp = (2**1000000005) % (10**9+7)
tmp = 500000004
ans = (ans*tmp) % (10**9+7)
print(ans)
# Original solution
MOD = 10**9 + 7


def main():
    N = int(eval(input()))
    A = [int(i) for i in input().split()]
    from itertools import accumulate
    S = list(accumulate([0] + A))
    ans = 0
    for i in range(N-1):
        ans += A[i] * (S[N] - S[i+1])
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
MOD = 10**9 + 7


def main():
    _ = int(eval(input()))
    A = [int(i) for i in input().split()]

    ans = (sum(A)**2) % MOD - (sum(pow(a, 2, MOD) for a in A)) % MOD
    ans *= pow(2, MOD-2, MOD)
    ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(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]
        ans %= int(1e9+7)
        
print(ans)

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

ans = 0
latsum = sum(a)-a[0]
for i in range(n-1):
    ans += a[i]*latsum
    ans %= int(1e9+7)
    latsum -= a[i+1]
        
print(ans)
# Original solution
N = int(eval(input()))
An_input = input().split()
An = [int(s) for s in An_input]

#print(An)
A = An[0] + An[1]
#print(A)

cnt = 0
M = 10**9 + 7

for i in range(0, N-1):
    #print(i)
    for l in range(1, N-i):
        cnt += An[i] * An[i+l]
        #print(An[i], An[i+l])
        #print(cnt)

ans = cnt % M
print(ans)

# Optimized solution
N = int(eval(input()))
An_input = input().split()
An = [int(s) for s in An_input]

cnt = 0
k = 0
M = 10**9 + 7

for i in range(0, N-1):
    k += An[i]
    cnt += k * An[i+1]

ans = cnt % M
print(ans)
# Original solution
import itertools
n = int(eval(input()))
a = list(map(int, input().split()))
mod_const = 1000000007
ans = 0
for i, j in list(itertools.combinations(a, 2)):
  ans += (i * j)
  if (ans >= mod_const):
    ans %= mod_const

print(ans)

# Optimized solution
mod_const = 1000000007
n = int(eval(input()))
a = list([int(x)%mod_const for x in input().split()])
ans = 0
for i in range(n):
  for j in range(n):
    if (j >= i):
      continue
    ans += (a[i] * a[j]) % mod_const
print((ans % mod_const))
# Original solution
import sys
import itertools

def resolve(in_):
    N = int(next(in_))
    A = list(map(int, next(in_).split()))

    mod = 10 ** 9 + 7
    ans = 0
    for i, a in enumerate(A):
        v = sum(A[i + 1:])
        ans += a * v
        ans %= mod

    return ans
    

def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()


# Optimized solution
import sys


def resolve(in_):
    N = int(next(in_))
    A = tuple(map(int, next(in_).split()))

    mod = 10 ** 9 + 7
    ans = 0
    v = sum(A)
    for a in A:
        v -= a
        ans += a * v
        ans %= mod

    return ans
    

def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
S = [0 for i in range(N-1)]

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

ans = sum(S)%(10**9+7)

print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
K = sum(A)
S = 0

for i in range(N-1):
    K = K - A[i]
    S = S + A[i]*K

ans = S%(10**9+7)

print(ans)
# Original solution
N, *A = list(map(int, open(0).read().split()))

MOD = 1000000007

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

# Optimized solution
from itertools import accumulate

MOD = 10 ** 9 + 7
N, *A = list(map(int, open(0).read().split()))

B = list(accumulate(A)) # cumsum

ans = 0
for i in range(N-1):
    ans += A[i] * (B[-1] - B[i]) % MOD
    ans %= MOD
print(ans)
# Original solution
def main():

    n = int(eval(input()))
    a = list(map(int,input().split()))

    import collections

    c = collections.Counter(a).most_common()

    m = 10**9 + 7
    ans = 0
    for i in range(0,len(c)):
        num1 = c[i][0]
        cnt1 = c[i][1]
        if cnt1 != 1:
            tmp = (num1**2) % m
            ans +=  tmp * ((cnt1 * (cnt1 - 1) ) // 2)
        for j in range(i+1, len(c)):
            num2 = c[j][0]
            cnt2 = c[j][1]
            tmp = (num1 * num2) % m
            ans += tmp * (cnt1 * cnt2)

    print((ans%m))

if __name__=='__main__':
    main()


# Optimized solution
def main():

    n = int(eval(input()))
    a = list(map(int,input().split()))


    m = 10**9 + 7
    ans = 0
    s = []
    total = sum(a)
    s.append(total-a[0])
    for i in range(1,n):
        s.append(s[i-1] - a[i])
    for i in range(n):
        tmp = s[i] % m
        ans += tmp * a[i]
    # ans //= 2
    print((ans%m))

if __name__=='__main__':
    main()
# Original solution
N = int(eval(input()))
a = list(map(int,input().split()))
mod = pow(10,9)+7
s = 0
for i in range(N-1):
    b = a[i]
    for j in range(i+1,N):
        s += b*a[j]
        s %= mod
print(s)

# Optimized solution
N = int(eval(input()))
a = list(map(int,input().split()))
a_s = sum(a)
mod = 10**9+7
s = 0
for i in range(N-1):
    b = a[i]
    a_s -= b
    s += b*(a_s)
    s %= mod
print(s)
# Original solution
from itertools import product

n = int(eval(input()))
arr = list(map(int, input().split()))
sum_arr = 0

list1 = list(product(arr, repeat = 2))

for (k, v) in list1:
    sum_arr = sum_arr + (k*v)
for value in arr:
    sum_arr = sum_arr - (value*value)
ans = int(sum_arr/2)
print((ans%1000000007))


# Optimized solution
n = int(eval(input()))
s = list(map(int, input().split()))
sum1 = sum(s)
sum2 = 0
for i in range(n):
    sum2 = sum2 + (sum1 - sum(s[:i+1]))*s[i]
print((sum2%1000000007))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

MOD = 10**9 + 7

ans = 0
for i in range(1, N):
    for j in range(i+1, N+1):
        # print("{}:{}".format(i, j))
        ans += A[i-1] * A[j-1]
        ans %= MOD
print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

MOD = 10 ** 9 + 7

ans = 0
s = sum(A)
for a in A:
    s -= a
    ans += s * a
    ans %= MOD

print(ans)
# Original solution
nn = int(eval(input()))
aa = list(map(int, input().split()))
bb = [0]*(nn-1)
mysum = sum(aa) % (10**9 + 7)
mydiff = 0

for i in range(1,nn):
    mydiff += aa[i - 1]
    tete = mysum - mydiff
    if tete >= 0:
        bb[i-1] = tete
    else:
        bb[i-1] = tete + 10**9+7

finalsum = 0
for i in range(nn-1):
        finalsum += aa[i]*bb[i]
        finalsum = finalsum % (10**9 + 7)

print(finalsum)

# Optimized solution
nn = int(eval(input()))
aa = list(map(int, input().split()))
bb = [0]*(nn-1)
mysum = 0
for i in range(nn):
    mysum += aa[i] % (10**9 + 7)
mydiff = 0

for i in range(1,nn):
    mydiff += aa[i - 1]
    tete = mysum - mydiff
    if tete >= 0:
        bb[i-1] = tete
    else:
        bb[i-1] = tete + 10**9+7

finalsum = 0
for i in range(nn-1):
        finalsum += aa[i]*bb[i]
        finalsum = finalsum % (10**9 + 7)

print(finalsum)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

sum_ = 0

for i in range(N):
    for j in range(i + 1, N):
        sum_ += A[i] * A[j]
        sum_ %= 1_000_000_007

print(sum_)


# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
tmp = sum(A)
sum_ = 0

for a in A:
    tmp -= a
    sum_ += a * tmp

print((sum_ % (1_000_000_007)))
# Original solution
MOD = 10**9 + 7
N = int(eval(input()))
arr = list(map(int, input().split()))
check = [0]*N
check[0] = arr[0]
check2 = [sum(arr)]*N
ans = 0
for i in range(N-1):
    check[i+1] = check[i]+arr[i+1]
for i in range(N):
    check2[i] -= check[i]
for i in range(N-1):
    ans += check2[i]*arr[i]
    ans %= MOD
print(ans)

# Optimized solution
MOD = 10**9 + 7
N = int(eval(input()))
arr = list(map(int, input().split()))
check = [sum(arr)]*N
ans = 0
tmp = 0
for i in range(N-1):
    tmp += arr[i]
    check[i] -= tmp
for i in range(N-1):
    ans += check[i]*arr[i]
    ans %= MOD
print(ans)
# Original solution
import itertools
N = int(eval(input()))
a = list(map(int,input().split()))

l = list(itertools.combinations(a,2))
ans = 0
for i in l:
    ans += i[0]*i[1]
print((ans%(10**9 + 7)))

# Optimized solution
N = int(eval(input()))
a = list(map(int,input().split()))
ans = 0
total = 0
for i in range(N):
    if i != 0:
        total += a[i-1]
        ans += a[i]*total
print((ans%(10**9 + 7)))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
mod = 1000000007
res = 0
a_sum = sum(a)

for i in range(n - 1):
    main = a.pop(0)
    a_sum = a_sum - main
    res =  (res + main * a_sum % mod) % mod
print(res)


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
mod = 1000000007
res = 0
a_sum = sum(a)

for i in range(n - 1):
    main = a[i]
    a_sum = a_sum - main
    res =  (res + main * a_sum % mod) % mod
print(res)
# Original solution
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]


import itertools

n = int(eval(input()))
seq = list(map(int, input().split()))

ans = 0
a = list(itertools.combinations(seq,2))

for i in range(len(a)):
    #print(a[i][0], a[i][1])
    ans += a[i][0] * a[i][1]
    ans %= 10**9+7


print(ans)



# Optimized solution
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]


N = int(eval(input()))
seq = list(map(int, input().split()))
ans = 0
for i in range(N -1):
    for j in range(i+1, N):
        tmp = (seq[i] * seq[j])
        ans += tmp
print((ans%(10**9+7)))