CodeEff/ECCO huggingface dataset:
# Original solution
x = (10**9)+7
n = int(eval(input()))
val = 0
lst = list(map(int,input().split()))
for i in range(len(lst)):
    lst[i] = lst[i]%x
for i in range(n-1):
    for j in range(i+1,n):
        val += ((lst[i])*(lst[j]))
print((val%x))

# Optimized solution
n = int(eval(input()))
arr = list(map(int,input().split()))
su = sum(arr)
c = 0
for item in arr:
  c+= item*item
print((((su**2 - c)//2)%(10**9 + 7)))
# Original solution
import itertools
n=int(eval(input()))
a=list(map(int,input().split()))
ans=0
for i in itertools.combinations(a,2):
    ans+=(i[0]*i[1])%(10**9+7)
print((ans%(10**9+7)))

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
ans=0
k=sum(a)
for i in a:
    k-=i
    ans+=i*k
print((ans%(10**9+7)))
# Original solution
# -*- coding: utf-8 -*-
N = int(eval(input()))
num_list = list(map(int, input().split(' ')))

ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        ans += num_list[i] * num_list[j] % (10**9 + 7)
        if ans >= (10**9 + 7):
            ans -= (10**9 + 7)

print(ans)

# Optimized solution
# -*- coding: utf-8 -*-
N = int(eval(input()))
num_list = list(map(int, input().split(' ')))

list_sum = sum(num_list)

ans = 0
for i in range(N-1):
    list_sum -= num_list[i]
    ans += num_list[i] * list_sum

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

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

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
sa=sum(a)
s=0
for i in range(n-1):
    sa-=a[i]
    s+=a[i]*sa
ans=s%(10**9+7)
print(ans)
# 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%=10**9+7
print(ans)

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

ans = 0

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

print((int(ans % (1e9 + 7))))


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

sum_a = 0
mul_a = 0
mod = 1000000007

for a in a_s:
    sum_a += a
    mul_a += a*a
    sum_a %= mod
    mul_a %= mod

ans = sum_a * sum_a
ans %= mod
ans -= mul_a
ans %= mod

n = mod-2
inv = 1
base = 2

while n:
    if n & 1:
        inv = inv*base % mod
    base = base*base % mod
    n >>= 1

ans *= inv
ans %= mod

print(ans)
# Original solution
import itertools

def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    ans = 0

    for v in itertools.combinations(A, 2):
        ans += v[0] * v[1]
    print((ans % 1000000007))
main()


# Optimized solution
def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    all_sum = sum(A) ** 2
    st = 0
    for i in range(N):
        st += A[i] ** 2
    print((int(((all_sum - st)//2) % 1000000007)))
main()
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
import itertools
ans = 0
for i in itertools.combinations(a, 2):
    ans += i[0]*i[1]
    ans%=10**9+7
print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
gou = sum(a)
ans = 0
for i in range(n):
    gou-=a[i]
    ans+=a[i]*(gou)
ans%=10**9+7
print(ans)
# Original solution
N = int(eval(input()))
A_ = list(map(int, input().split()))
A = []
mod = 10 ** 9 + 7
for a_ in A_:
    a = a_ % mod
    A.append(a)

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

print(ans)

# Optimized solution
N = int(eval(input()))
A_ = list(map(int, input().split()))
A = []
mod = 10 ** 9 + 7
for i, a_ in enumerate(A_[::-1]):
    if i == 0:
        A.append(a_ % mod)
    else:
        a = (a_ + A[-1]) % mod
        A.append(a)
A = A[::-1]
A = A[1:]
ans = 0
for i, a in enumerate(A_[:-1]):
    ans += A[i] * a % mod
    ans %= mod

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

mod = 10**9 + 7
num_sum = 0

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

print((num_sum % mod))



# Optimized solution
N = int(eval(input()))
num_list = list(map(int, input().split()))
mod = 10**9 + 7

sum_num = 0
sum_list = []
for num in num_list:
  sum_num += num
  sum_num = sum_num % mod
  sum_list.append(sum_num)

answer = 0
for i in range(N):
  sum_num -= num_list[i]
  sum_num = sum_num if sum_num >= 0 else sum_num + mod
  answer += num_list [i] * sum_num
  answer = answer % mod

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

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

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
s = [0] * n
s[n - 1] = a[n - 1]
for i in range(n - 2, -1, -1):
    s[i] = s[i + 1] + a[i]
    
ans = 0
mod = 10 ** 9 + 7
for i in range(n - 1):
    ans += a[i] * s[i + 1]
print((ans % mod))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split(' ')))
const = 1000000007
ans = 0
a = 0
for i in range(N):
    for j in range(i + 1, N):
        a += A[j]
    ans += A[i] * a
    a = 0
print((ans%const))

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

for i in range(n):
    for j in range(i+1,n):

        ans += a[i]*a[j]
print((ans%mod))

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
ans = sum(a)**2
mod = 10**9 + 7

for i in range(n):
    ans -= a[i]**2
ans //= 2
print((ans%mod))
# 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 = ans % (10 ** 9 + 7)

print(ans)

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

sum_a = sum(a)

ans = 0

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

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

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

tot = 0
num2 = [0]*(N-1)

for i in range(len(num)-1):
  num2[i] = sum(num[1+i:]) % (10**9+7)
  
for i in range(len(num)-1):
  num1 = num[i] % (10**9+7)
  
  tot += num1 * num2[i]
  
  if tot >= (10**9+7): tot = tot % (10**9+7)

print(tot)

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

tot = 0
num2 = [0]*(N-1)
numtot = sum(num)

for i in range(len(num)-1):
  numtot -= num[i]
  num2[i] = numtot % (10**9+7)
  
  num1 = num[i] % (10**9+7)
  
  tot += num1 * num2[i]
  
  if tot >= (10**9+7): tot = tot % (10**9+7)

print(tot)
# Original solution
def inp():
    return eval(input())
def iinp():
    return int(eval(input()))
def inps():
    return input().split()
def miinps():
    return list(map(int,input().split()))
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = iinp()
a = lmiinps()

ans = 0

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

ans %= (10**9+7)

print(ans)

# Optimized solution
def inp():
    return eval(input())
def iinp():
    return int(eval(input()))
def inps():
    return input().split()
def miinps():
    return list(map(int,input().split()))
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = iinp()
a = lmiinps()

ans = 0
count = 0

for i in range(n):
    count += (a[i]%(10**9+7))

for i in range(n):
    count -= a[i]
    ans += (a[i]%(10**9+7))*count


ans %= (10**9+7)

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

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
cs = A[:]
for i in range(1, N):
	cs[i] += cs[i-1]
sum = 0
for i in range(0, N-1):
	sum += A[i] * (cs[-1] - cs[i])
print((sum % mod))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
s = 0
for i in range(n):
    for j in range(i + 1, n):
        s += a[i] * a[j]
        s %= 1000000007
print((s % 1000000007))


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
s1 = sum(a)
s2 = 0
ans = 0
for i in range(n - 1):
    s2 += a[i]
    ans += a[i] * (s1 - s2)
print((ans % 1000000007))
# Original solution
n = eval(input())
a = [int(num) for num in input().split(" ")]

mod_value = 10**9 + 7

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


# Optimized solution
n = eval(input())
a = [int(num) for num in input().split(" ")]

mod_value = 10**9 + 7

sum = 0
total = 0
for i in reversed(list(range(1, len(a)))):
    sum += a[i]
    total += a[i-1] * sum

print((total%mod_value))
# Original solution
n = int(eval(input()))
a  = [int(i) for i in input().split()]
mod = 10 ** 9 + 7
ans = 0
for i in range(n):
    for j in range(i+1, n):
        ans += (a[i] * a[j]) % mod
        ans %= mod

print(ans)

# Optimized solution
from itertools import accumulate
n = int(eval(input()))
a = [int(i) for i in input().split()]
mod = 10 ** 9 + 7
a_acc = list(accumulate(a))
ans = 0
for i in range(n):
    ans += (a[i] * (a_acc[-1] - a_acc[i])) % mod
    ans %= mod
print(ans)
# Original solution
MOD = 10**9 + 7
N = int(eval(input()))

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

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

# Optimized solution
MOD = 10**9 + 7
N = int(eval(input()))

modsum = 0
A = list(map(int, input().split()))
for a in A:
    modsum = (modsum + a) % MOD

count = 0
for a in A[:-1]:
    modsum -= a
    while modsum < 0:
        modsum = MOD + modsum
    count = (count + (modsum * a) % MOD) % MOD
print(count)
# Original solution
import itertools

N=int(eval(input()))
A = tuple(map(int,input().split(" ")))
ans = 0

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


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

# Optimized solution
N=int(eval(input()))
A = tuple(map(int,input().split(" ")))
ans = 0

sum_ = sum(A)
for i in range(N):
    sum_ -= A[i]
    ans += sum_ * A[i]

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

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
b = sum([(i**2) for i in a])
print((((sum(a)**2-b)//2)%(10**9+7)))
# Original solution
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import combinations
def main():
    n, *a = list(map(int, read().split()))
    large_p = 10 ** 9 + 7
    a2 = [i % large_p for i in a]
    com = tuple(combinations(a2, 2))
    r = 0
    for come in com:
        r += (come[0] * come[1]) % large_p
        r = r % large_p
    print(r)


if __name__ == '__main__':
    main()

# Optimized solution
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import accumulate
def main():
    n, *a = list(map(int, read().split()))
    large_p = 10 ** 9 + 7
    aac = tuple(accumulate(a))
    r = 0
    for i1 in range(n):
        t1 = aac[-1] - aac[i1]
        r += (t1 * a[i1]) % large_p
    r = r % large_p
    print(r)


if __name__ == '__main__':
    main()
# Original solution
from itertools import combinations

N = int(eval(input()))
A = list(map(int, input().split()))
ref = list(combinations(A, 2))
res = 0

for i in range(len(ref)):
  a, b = ref[i]
  res += ((a * b) % (10 ** 9 + 7))
print((res % (10 ** 9 + 7)))

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

res = 0

for i in range(len(A)):
  a = A[i]
  nokori = A[i+1:]
  for j in nokori:
    res += (a * j) % (10 ** 9 + 7)
print((res % (10 ** 9 + 7)))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

mod = 10**9+7

tmp = 0
for i in range(N):
    tmp += A[i]
    tmp = tmp % mod
all = (tmp % mod)**2
all = all % mod

tmp = 0
for i in range(N):
    tmp += (A[i]* A[i]) % mod
di = tmp % mod

ans = all - di
ans *= (mod + 1) // 2
ans %= mod

print(ans)

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

mod = 10**9+7

S = sum(A)
S2 = sum([x*x for x in A])

print(((S*S - S2)//2 % mod))
# Original solution
mod = 10**9 + 7
n = int(eval(input()))
A = list([int(x) % mod for x in input().split()])

out = 0
for i in range(n - 1):
    for j in range(n - i - 1):
        k = i + j + 1
        # print(A[i], A[k])
        out += (A[i] * A[k])
        out %= mod
print(out)

# Optimized solution
mod = 10**9 + 7
n = int(eval(input()))
A = list([int(x) % mod for x in input().split()])

# out = 0
# for i in range(n - 1):
#     for j in range(n - i - 1):
#         k = i + j + 1
#         # print(A[i], A[k])
#         out += (A[i] * A[k])
#         out %= mod
B = A[1:n]
B_s = 0
for i in range(n - 1):
    B_s += B[i] % mod

out = 0
for i in range(n - 1):
    out += A[i] * B_s
    out %= mod
    B_s -= A[i + 1]
    B_s %= mod
    if B_s < 0:
        B_s += mod

print(out)
# Original solution
import sys
import bisect
from functools import lru_cache
from collections import defaultdict
inf = float('inf')
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline().rstrip()
def read():
  return int(readline())
def reads():
  return list(map(int, readline().split()))
n=read()
a=list(reads())
num=0
l=len(a)
for i in range(l-1):
    for j in range(i+1,l):
        num+=a[i]*a[j]
num%=10**9+7
print(num)

# Optimized solution
import sys
import bisect
from functools import lru_cache
from collections import defaultdict
inf = float('inf')
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline().rstrip()
def read():
  return int(readline())
def reads():
  return list(map(int, readline().split()))
n=read()
a=list(reads())
num=0
l=len(a)
ls=[]
k=0
for i in range(l-1,0,-1):
    k+=a[i]
    ls.append(k)
for i in range(l-1):
    num+=a[i]*ls[-i-1]
num%=10**9+7
print(num)
# Original solution
from itertools import accumulate

n = int(eval(input()))
a = list(map(int, input().split()))
s = list(accumulate(a))
MOD = 10 ** 9 + 7

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

print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7

s = sum(a) ** 2
t = sum(ai ** 2 for ai in a)
ans = (s - t) * pow(2, MOD - 2, MOD)
ans %= MOD
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
m = 1000000007
s = 0
suma = sum(a)
for i in range(n):
    suma -= a[i]
    s += a[i] * suma
print((s % m))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
m = 1000000007
print((((sum(a)**2 - sum([x**2 for x in a])) // 2) % m))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))

import itertools

seq=[x for x in range(0,n)]
l=list(itertools.combinations(seq,2))

ans=0

for ll in l:
  ans += a[ll[1]] * a[ll[0]]

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

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

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

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

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

sum = sum(A)
result = 0

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

print((result%(10**9+7)))
# Original solution
# coding:UTF-8
import sys


def resultSur97(x):
    return x % (10 ** 9 + 7)


if __name__ == '__main__':
    # ------ 入力 ------#
    # 1行入力
    n = int(eval(input()))    # 数字
    aList = list(map(int, input().split()))     # スペース区切り連続数字

    # ------ 処理 ------#
    pro = 0
    for i in range(1,n+1):
        sum = 0
        for j in range(i+1,n+1):
            sum += aList[j-1]
        pro += sum * aList[i-1]

    out = resultSur97(pro)

    # ------ 出力 ------#
    print(("{}".format(out)))
    # if flg == 0:
    #     print("YES")
    # else:
    #     print("NO")


# Optimized solution
# coding:UTF-8
import sys


def resultSur97(x):
    return x % (10 ** 9 + 7)


if __name__ == '__main__':
    # ------ 入力 ------#
    # 1行入力
    n = int(eval(input()))    # 数字
    aList = list(map(int, input().split()))     # スペース区切り連続数字

    # ------ 処理 ------#
    sum = 0
    for i in range(0, n):
        sum += aList[i]

    pro = 0
    for i in range(0, n):
        ai = aList[i]
        sum = sum - ai
        pro += sum * aList[i]

    out = resultSur97(pro)

    # ------ 出力 ------#
    print(("{}".format(out)))
    # if flg == 0:
    #     print("YES")
    # else:
    #     print("NO")
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

ans = 0

for i in range(len(a)):
  for j in range(i+1, len(a)):
    ans = (a[i] * a[j]) % 1000000007 + ans % 1000000007
    
print(ans)

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

ans = 0

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

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

mod_n = 10**9+7

cum_A = [0]
for i in range(n-1):
  cum_A.append(cum_A[i]+A[::-1][i])
  
ans = 0
for i in range(n-1):
  ans += A[i]*cum_A[::-1][i]%mod_n
  
print((ans%mod_n))

# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))
B = A[::-1]

mod_n = 10**9+7

cum_A = [0]
for i in range(n-1):
  cum_A.append(cum_A[i]+B[i])
  
ans = 0
cum_B = cum_A[::-1]
for i in range(n-1):
  ans += A[i]*cum_B[i]%mod_n
  
print((ans%mod_n))
# Original solution
import itertools
n = int(eval(input()))
a = list(map(int, input().split()))
c = 0
for pp in list(itertools.combinations(a,2)):
  c += (pp[0] * pp[1]) % (10 **9 + 7)
print((c % (10 **9 + 7)))


# Optimized solution
import itertools
n = int(eval(input()))
a = list(map(int, input().split()))
c = 0
for i in range(0, len(a) -1):
  for j in range(i + 1, len(a)):
    c += (a[i] * a[j]) % 1000000007
print((c % 1000000007))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))

sum=0
tmp=0
for i in range(n):
    o = i+1
    tmp = 0
    while (o<n):
        tmp=a[o]+tmp
        o=o+1
    sum=(a[i]%1000000007*tmp%1000000007)%1000000007+sum%1000000007

print((sum%1000000007))

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
mod=1000000007
sum=0
tmp=0
o=0
while(o<n):
    tmp = (a[o]%mod + tmp%mod)%mod
    o += 1

for i in range(n):
    tmp=(tmp%mod-a[i]%mod)%mod
    sum=((a[i]%mod)*tmp)%mod+sum%mod



print((sum%mod))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

sum = 0

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

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
 
# required function 
def findProductSum(A, n): 
      
    # calculating array sum (a1 + a2 ... + an) 
    array_sum = 0
    for i in range(0, n, 1): 
        array_sum = array_sum + A[i] 
  
    # calcualting square of array sum 
    # (a1 + a2 + ... + an)^2 
    array_sum_square = array_sum * array_sum 
  
    # calcualting a1^2 + a2^2 + ... + an^2 
    individual_square_sum = 0
    for i in range(0, n, 1): 
        individual_square_sum += A[i] * A[i] 
  
    # required sum is (array_sum_square - 
    # individual_square_sum) / 2 
    return (array_sum_square - 
            individual_square_sum)
mod = 10**9+7
  
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
  
print((modinv(2)*int(findProductSum(a, n))%mod))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))

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

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

mo=10**9+7
an=0
wk=0
ru=[]
for i in a:
    wk+= i
    ru.append(wk%mo)
for i in range(n-1):
    an+=a[i]*(ru[n-1]-ru[i])
    an%=mo

print(an)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
mod=1000000007
ans=0

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

print(ans)

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
mod=1000000007
ans=0
s=0
for i in range (n-1):
    if i ==0:
        for j in range(i+1,n):
            s=(s+a[j])%mod
    else:
        s-=a[i]
    ans=(ans+(a[i]*(s))%mod)%mod

print(ans)
# Original solution
N = int(eval(input()))
A = [int(x) for x in input().split(" ")]

from itertools import combinations

mod = 1000000007  # 丁度いい大きさの素数だけで意味は特にない。
s = 0
for c in combinations(A, 2):
    s += c[0] * c[1]

print((s % mod))

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

from itertools import combinations

mod = 1000000007  # 丁度いい大きさの素数だけで意味は特にない。

s = 0
ans = 0
for n in A:
    s += n
    s %= mod

for i in range(N):
    s -= A[i]
    ans += A[i] * s
    ans %= mod

print(ans)
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
#437235829 mod(10^9+7)
sumA=0
for i in range(N-1):
  for j in range(1,N-i):
    sumA+=A[i]*A[i+j]

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



# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
#437235829 mod(10^9+7)
sumAcol=0
sumA=0
sumtr=0
for i in range(N):
  sumtr+=A[i]**2
  sumAcol+=A[i]
  sumtr=sumtr % (10**9+7)
  sumAcol=sumAcol % (10**9+7)

for i in range(N):
  sumA+=(sumAcol*A[i])%(10**9+7)
  
sumA=(sumA-sumtr)+10**9+7

print((sumA*(5*10**8+4) % (10**9+7)))
# Original solution
N = int(eval(input()))
l = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += (l[i] * l[j])
print((ans%mod))

# Optimized solution
N = int(eval(input()))
l = list(map(int,input().split()))
mod = 10**9 + 7

area = sum(l) * sum(l)

for i in l:
    area -= i*i

ans = area//2
ans = ans % mod
print(ans)
# Original solution
n = int(eval(input()))
a_list = list(map(int, input().split()))

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

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

s_2 = 0
for i in a_list:
    s_2 += i**2

ans = (sum(a_list)**2 - s_2)//2  

ans = ans%(10**9+7)
print(ans)
# Original solution
import itertools

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

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

print((ans % 1000000007))

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

for i in range(n-1):
  num+=a[i]
  ans+=a[i+1]*num
  
print((ans%1000000007))