n = int(eval(input()))

l = eval(input())

a = l.split(' ')



tmp = 0

tmp2 = 0



for i in range(n):

    tmp += int(a[i])



for i in range(n):

    tmp2 += int(a[i])*int(a[i])



print(((tmp*tmp-tmp2)//2%1000000007))
m = 1000000007



N, *A = list(map(int, open(0).read().split()))



result = 0

c = 0

for a in A:

    result += c * a

    result %= m

    c += a

    c %= m

print(result)

n = int(eval(input()))
l = eval(input())
a = l.split(" ")
tmp = 0
tmp2 = 0
for i in range(n):
    tmp += int(a[i])
for i in range(n):
    tmp2 += int(a[i]) * int(a[i])
print(((tmp * tmp - tmp2) // 2 % 1000000007))

m = 1000000007
N, *A = list(map(int, open(0).read().split()))
result = 0
c = 0
for a in A:
    result += c * a
    result %= m
    c += a
    c %= m
print(result)

-n = int(eval(input())) -l = eval(input()) -a = l.split(" ") -tmp = 0 -tmp2 = 0 -for i in range(n): -    tmp += int(a[i]) -for i in range(n): -    tmp2 += int(a[i]) * int(a[i]) -print(((tmp * tmp - tmp2) // 2 % 1000000007)) +m = 1000000007 +N, *A = list(map(int, open(0).read().split())) +result = 0 +c = 0 +for a in A: +    result += c * a +    result %= m +    c += a +    c %= m +print(result)