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

# Optimized solution
mod = 10**9+7
n = int(eval(input()))
input_list = list(map(int,input().split()))
input_len = len(input_list)
remain_num = sum(input_list[1:])
remain_list = [remain_num]
for i in range(1,input_len):
    remain_list.append(remain_list[i-1]-input_list[i])

temp = 0
for i in range(input_len):
    temp = (temp+input_list[i]*remain_list[i])%mod
print(temp)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

sum = 0

for i in range(n-1):
    sum_i = 0
    for j in range(n-i-1):
        sum_i += a[-(j+1)]
    sum += (sum_i * a[i])

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

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

sum_a = 0
sum_i = sum(a)

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

print((sum_a%((10 **9)+7)))
# Original solution
n=int(eval(input()))
i = list(map(int, input().split())) 

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

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


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

m=sum(i)

ans=0
for k in range(n):
    ans+=(i[k]*(m-i[k]))
ans=ans//2
ans=ans%(10**9+7)
print(ans)
# Original solution
import math
N = eval(input())
nums = [int(i) for i in input().split(' ')]

sum = 0

for i in range(len(nums)-1):
    for ii in range(len(nums)-i-1):
        sum += nums[i]*nums[i+ii+1]

sum = sum%(math.pow(10,9)+7)
print((int(sum)))


# Optimized solution
N = eval(input())
a_list = [int(i) for i in input().split(' ')]
mod = 1000000007

sum_list = []
sum = 0
for i in a_list:
  sum += i
  sum_list.append(sum)

sum = 0
for idx, i in enumerate(a_list[:-1]):
  sum += i*(sum_list[-1]-sum_list[idx])
  
print((sum%mod))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

ans = 0

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

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

sm = sum(a)
ans = 0

for i in range(len(a)):
    ans += a[i]*(sm-a[i])
    sm = sm - a[i]
    ans %= (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):
  ans += a[i]*sum(a[i+1:])
  ans %= 10**9+7
print(ans)

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

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

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

print(ans)


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

ans = 0
mod = 10**9+7

S = sum(a)

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

    sum_a = 0

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

  #  print(sum_a)

    ans = sum_a % 1000000007

    print(ans)


if __name__ == "__main__":
    solve()



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

    sum_a = 0
    tmp = 0
    
    for i in range(N-1):
        tmp += A[i]
        sum_a += tmp * A[i+1]

  #  print(sum_a)

    ans = sum_a % 1000000007

    print(ans)


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

data = input().split()

data = [int(s) for s in data]

num = 0
ans = 0

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

print((ans % 1000000007))

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

data = input().split()

data = [int(s) for s in data]

num = 0
ans = 0
sum = sum(data)

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

print((ans % 1000000007))
# Original solution
import math
import itertools


# 与えられた数値の桁数と桁値の総和を計算する.
def calc_digit_sum(num):
    digits = sums = 0
    while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
    return digits, sums


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

MOD = 10 ** 9 + 7

answer = 0
for idx1 in range(len(arr) - 1):
    for idx2 in range(idx1 + 1, len(arr)):
        answer = (answer + (arr[idx1] * arr[idx2])) % MOD

print(answer)

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

mod = 10 ** 9 + 7
sums = sum(arr)

answer = 0
for num in arr:
    sums -= num
    answer = (answer + (sums * num)) % mod

print(answer)
# Original solution
#C - Sum of product of pairs
N = int(eval(input()))
A = list(map(int,input().split()))
SUM = 0
MOD = 1000000007
for i in range(N-1):
    for j in range(i+1,N):
            SUM = (SUM + (A[i] * A[j] % MOD) ) % MOD

# 出力
print(SUM)


# Optimized solution
#C - Sum of product of pairs
N = int(eval(input()))
A = list(map(int,input().split()))
SUM = 0
jsum= 0
MOD = 1000000007
for j in range(N):
    jsum = (jsum + A[j]) % MOD

for i in range(N-1):
    jsum = (jsum - A[i]) % MOD
    SUM = ( SUM + (jsum * A[i] % MOD ) ) % MOD

# 出力
print(SUM)
# Original solution
N = int(eval(input()))
l = list(map(int,input().split()))
s = 0
for i in range(len(l)-1):
    for j in range(1,len(l)-i):
        s = s + l[i]*l[i+j]
s = s%(pow(10,9)+7)
print(s)

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
S = sum(A)
S2 = sum([x**2 for x in A])
 
print(((S**2-S2)//2%(1000000000+7)))
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
import itertools
ans = 0
result = []


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

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

ans = 0

sum_a = sum(a)


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

print((ans%(10 ** 9 + 7)))
# Original solution
n = int(eval(input()))

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

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

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

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

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

ans = 0
s = sum(nums)
for i in range(n):
    s -= nums[i]
    ans += nums[i] * s

print((ans % (10**9+7)))
# Original solution
n = int(eval(input()))
A = list(map(int,input().split()))

s = [0]*n

for i in range(n):
    s[i] = sum(A[i+1:])


tot = 0
for i in range(n-1):
    tot += A[i]*s[i]
    
print((tot%(10**9+7)))

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

a = A[::-1]
s = [0]*(n+1)

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

s = s[:n]
s = s[::-1]

tot = 0
for i in range(n-1):
    tot += A[i]*s[i]
    
print((tot%(10**9+7)))
# Original solution
N = int(eval(input()))
A = [int(x) for x in input().split()]

mod = 10**9 + 7
a = 0
for i in range(0, N - 1):
    for j in range(i + 1, N):
        a += (A[i] * A[j])
print((a % mod))

# Optimized solution
mod = 10**9 + 7

N = int(eval(input()))
A = [int(x) for x in input().split()]
S = sum(A) % mod

ans = 0
for i in range(N):
    S -= A[i]
    if S < 0: S += mod

    ans += S * A[i]
    ans %= mod
print(ans)
# Original solution
N = int(eval(input()))
X = list(map(int, input().split()))
p = 0
for n in range(N):
  for m in range(n+1, N):
    p += X[n]*X[m]
  if p >= 10**9 + 7:
     p = p % (10**9 + 7)
      
      #while p >= 10**9 + 7:
        #p -= 10**9 + 7
      
print(p)

# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))
p = 0
s = sum(X)
for n in range(N):
  s -= X[n] 
  s = s % (10**9 + 7)
  p += s * X[n]
  p = p % (10**9 + 7)

print(p)
# Original solution
import itertools
n = int(eval(input()))
li = list(map(int,input().split()))
asum = 0
newli = list(itertools.combinations(li,2))
for i in range(n*(n-1)//2):
    asum += newli[i][0]*newli[i][1]
    if asum >= 10**9 + 7:
        asum = asum % (10**9 + 7)
print(asum)

# Optimized solution
n = int(eval(input()))
li = list(map(int,input().split()))
licumsum = 0
for i in range(n):
    licumsum += li[i]
asum = 0
for i in range(n):
    asum += li[i]*(licumsum - li[i])
    if asum >= (10**9 + 7)*2:
        asum = asum % ((10**9 + 7)*2)
if asum//2 >= 10**9 + 7:
    print((asum//2-(10**9+7)))
else:
    print((asum//2))
# Original solution
N = int(eval(input()))
S = list(map(int, input().split(' ')))

prod=0

law=10**9+7

for i in range(N):
  for j in range(i+1, N):
    prod=prod+((S[i]%law)*(S[j]%law))%law
    
print((prod%law))

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

prod=0

law=10**9+7

sumation=sum(S)

for i in range(N):
  sumation=sumation-S[i]
  prod=prod+(S[i]*sumation)%law

print((prod%law))
# Original solution
N = int(eval(input()))
A = [int(a) for a in input().split()]

import itertools

sum = 0
for i, j in itertools.combinations(A, 2):
    sum += i * j

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

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

mod = 10**9 + 7

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

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

squ = 0
num = 10 ** 9 + 7

a_sum = 0
for i_sum in range(1, n):
    a_sum += a_int[i_sum]

for i in range(0, n-1):
    squ += a_int[i] * a_sum
    a_sum -= a_int[i+1]

ans = squ % num
print(ans)
# Original solution
import itertools

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

mod = 10**9 + 7

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

print((ans%mod))

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

mod = 10**9 + 7

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

print((ans%mod))
# Original solution
#!/usr/bin/env python3
def main():
    _ = int(eval(input()))
    A = [int(x) for x in input().split()]
    mod = 10 ** 9 + 7

    lst = [sum(A)]
    for j in A:
        lst.append(lst[-1] - j)
    ans = 0
    for index, i in enumerate(A):
        ans += i * lst[index + 1] % mod
    print((ans % mod))


if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
def main():
    _ = int(eval(input()))
    A = [int(x) for x in input().split()]
    mod = 10 ** 9 + 7

    sum_A = sum(A) % mod
    ans = 0
    for a in A:
        sum_A -= a
        if sum_A < 0:
            sum_A += mod
        ans += a * sum_A
        ans %= mod
    print((ans % mod))


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
A = list(map(int, input().split()))

ans = 0
for i in range(n-1):
    ans = (ans + A[i] * sum(A[i+1:])) % int(1e9 + 7)

print(ans)


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

s = sum(A)
ans = 0
for i in range(n-1):
    s -= A[i]
    ans = (ans + A[i] * s) % int(1e9 + 7)

print(ans)
# Original solution
num = int(eval(input()))
input_line = input().split()

law = 10 ** 9 + 7
num_list = [int(input_line[i])%law for i in range(num)]

sigma = 0
for i in range(num):
	num_a = num_list[i]
	temp_sum = 0
	for j in range(i+1,num):
		temp_sum += num_list[j]
    	
    
	sigma += num_a * temp_sum

sigma %= law
print(sigma)

# Optimized solution
num = int(eval(input()))
input_line = input().split()

law = 10 ** 9 + 7
num_list = [int(input_line[i])%law for i in range(num)]

sigma = 0
temp_sum = 0
for j in range(num):
	temp_sum += num_list[j]

for i in range(num):
	num_a = num_list[i]
	temp_sum -= num_a
	sigma += num_a * temp_sum


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


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

MOD = 10**9 + 7

n = int(eval(input()))

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

sum = 0
for index, i in enumerate(a[:n - 1]):
    for j in a[index + 1:n]:
        sum = (sum + (i * j)) % MOD

print(sum)

# Optimized solution
import sys

MOD = 10**9 + 7

n = int(eval(input()))

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

x = pow(sum(a), 2)
y = sum((a[i]**2 for i in range(n)))

sum = (x - y) // 2 % MOD

print(sum)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
Ans = 0
S = []
for j in range(N-1):
    S.append(sum(A[:N-j-1]))

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

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

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

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

print((Ans%((10**9)+7)))
# 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 %= 1000000007
print(ans)


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

seki_list = []
for i in range(N-1):
    seki = sum(A[i+1:])
    seki_list.append(seki)

ans  = 0
for i in range(N-1):
    seki = A[i]*seki_list[i]
    ans += seki

print((ans % mod))

# Optimized solution
N = int(eval(input()))
A = [int(s) for s in input().split()]
mod = 10**9+7

wa = 0
wa_list = []
for i in range(N)[::-1]:
    if i == 0:
        break
    wa += A[i]
    wa_list.append(wa)

wa_list.reverse()
ans  = 0
for i in range(N-1):
    seki = A[i]*wa_list[i]
    ans += seki

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

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


# Optimized solution
mod=1000000007
n=int(eval(input()))
x=list(map(int,input().split()))
cl=[1]
for i in range(1,n):
    cl.append(cl[i-1]+x[i])
sum=0
for i in range(n-1):
    sum+= x[i]*(cl[n-1]-cl[i])
    sum%=mod

print(sum)
# Original solution
import sys
read = sys.stdin.readline
import time
from heapq import heappush, heappop, heapify
import math
import itertools as it
from collections import deque 


def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

mod = 10**9 + 7

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

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)



# Optimized solution
import sys
read = sys.stdin.readline
import time
from heapq import heappush, heappop, heapify
import math
import itertools as it
from collections import deque 


def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------


mod = 10**9 + 7

N = inp()
A = inpl()
wa = 0
sm = A[0]
for i in range(1, N):
    wa = (wa + sm * A[i]) % mod
    sm = (sm + A[i]) % mod
print(wa)

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)
# Original solution
def main():
    n = int(eval(input()))
    A = [int(x) for x in input().split()]
    mod = 10**9+7
    a_sum = sum(A)
    a_cum = [0] * (n+1)
    for i in range(n):
        a_cum[i + 1] = a_cum[i] + A[i]
    ans = 0
    for i in range(len(A)-1):
        ans += A[i] * (a_sum - a_cum[i+1]) % mod
        ans %= mod
    print(ans)

if __name__ == '__main__':
    main()

# Optimized solution
def main():
    n = int(eval(input()))
    A = [int(x) for x in input().split()]
    mod = 10**9+7
    # a_sum = sum(A)
    a_cum = [0] * (n+1)
    for i in range(n):
        a_cum[i + 1] = a_cum[i] + A[i]
    ans = 0
    for i in range(len(A)-1):
        ans += A[i] * (a_cum[n] - a_cum[i+1])
    ans %= mod
    print(ans)

if __name__ == '__main__':
    main()
# Original solution
def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    mod = 10 ** 9 + 7
    A_mod = [a % mod for a in A]
    ans = 0
    for i in range(N-1):
        sum_mod = sum(A_mod[i+1:]) % mod
        mul_mod = (A_mod[i] * sum_mod) % mod
        ans = (ans + mul_mod) % mod
    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    mod = 10 ** 9 + 7
    A_cum_sum = [A[-1]]
    for a in A[::-1][1:]:
        A_cum_sum.append(a + A_cum_sum[-1])
    A_cum_sum = A_cum_sum[::-1]
    ans = 0
    for i in range(N-1):
        sum_mod = A_cum_sum[i+1] % mod
        mul_mod = (A[i] * sum_mod) % mod
        ans = (ans + mul_mod) % mod
    print(ans)


if __name__ == '__main__':
    main()
# 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]
a =10**9+7
print((sum%a))

# Optimized solution
N=int(eval(input()))
A =list(map(int,input().split()))
S =(sum(A))**2
for i in A:
        S-=i**2
a =10**9+7
print(((S//2)%a))
# 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]
    
ans = sum % (10**9 + 7)

print(ans)


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

for i in range(N):
  sum_a += A[i] 

for i in range(N):
  sum_a -= A[i]
  sum += A[i] * sum_a
  ans = sum % (10**9 + 7)

print(ans)
# Original solution
#!/usr/bin/env python3

n=int(eval(input()))  #->n=5
ai=list(map(int,input().split()))  #->nl=[1,2,-,n]

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

print(temp)



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

n=int(eval(input()))  #->n=5
a=list(map(int,input().split()))  #->nl=[1,2,-,n]
mod=int(1e9+7)

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

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

MOD=7+10**9
SUM=sum(A)
ans=0

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

# Optimized solution
n = int(eval(input()))
mod = 10**9+7
ls = list(map(int,input().split()))
di = [i**2 for i in ls]
print(((((sum(ls)**2)-(sum(di)))//2)%mod))
# Original solution
N = int(eval(input()))
L = list(map(int, input().split()))

Ans = 0

for i in range(len(L)):
    for j in range(i+1,len(L)):
        #print(L[i] * L[j])
        Ans += (L[i] * L[j])%(10**9+7)
        #Ans += L[i] * L[j]
        #if Ans >= 10**9+7:
            #Ans = Ans%(10**9+7)
Ans = Ans%(10**9+7)
print(Ans)

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

Ans = 0

sum_L = L[0]

l = len(L)

for i in L[1:]:
    Ans += sum_L*i%(10**9+7)
    sum_L += i
Ans = Ans%(10**9+7)
print(Ans)
# Original solution
import itertools
n = int(eval(input()))
a = list(map(int,input().split()))
ans = 0
m = 10**9 + 7
for item in itertools.combinations(a, 2):
    ans += item[0] * item[1]
print((ans % m))

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

# Optimized solution
N = int(eval(input()))
a = [int(s) for s in input().split()]
ans = int(0)
temp = int(0)
MOD = int(1000000007)
sumari = sum(a)

for i in range(N-1):
  sumari = sumari - a[i] 
  temp = sumari % MOD
  temp = temp * a[i]
  temp = temp % MOD
  ans += temp
  ans = ans % MOD
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, 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]

print((ans%mod))


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
s = [0] * n

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

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

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))
# Original solution
import itertools

N = int(eval(input()))
A = [int(n) for n in input().split()]
ans = 0
m = 1000000007

for x, y in itertools.combinations(A, 2):
    ans += x * y

print((ans % m))


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

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

print((ans % m))
# Original solution
n = int(eval(input()))
li = list(map(int,input().split()))

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

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

mo = 10**9 + 7
ans = 0
su = li[0]
for i in range(1,len(li)):
    ans += li[i]*su
    su+=li[i]
print((ans % mo))
# Original solution
import itertools

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

result = 0
for itr in itertools.combinations(A,2):
    result = (result + (itr[0]*itr[1])%M)%M

print(result)

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

ruisekiwa = [0]*N
wa = sum(A)%M

result = 0
for i in range(N):
    wa -= A[i]
    result = (result+(A[i]*wa)%M)%M

print(result)