n = int(eval(input()))

#a, b = map(int,input().split())

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

#l = [list(map(int,input().split())) for i in range(n)]

mod = 10**9+7

cuml = [al[0]]

for i in range(n-2):

    cuml.append((cuml[i]+al[i+1]) % mod)

ans = 0

for i in range(1, n):

    ans = (ans+cuml[i-1]*al[i]) % mod

print(ans)

n = int(eval(input()))

#n, m = map(int, input().split())

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

#al=[list(input()) for i in range(n)]

mod = 10**9+7

add = 0

ans = 0

for i in range(n-1, 0, -1):

    add = (add+al[i]) % mod

    ans = (ans+add*al[i-1]) % mod



print(ans)

n = int(eval(input()))
# a, b = map(int,input().split())
al = list(map(int, input().split()))
# l = [list(map(int,input().split())) for i in range(n)]
mod = 10**9 + 7
cuml = [al[0]]
for i in range(n - 2):
    cuml.append((cuml[i] + al[i + 1]) % mod)
ans = 0
for i in range(1, n):
    ans = (ans + cuml[i - 1] * al[i]) % mod
print(ans)

n = int(eval(input()))
# n, m = map(int, input().split())
al = list(map(int, input().split()))
# al=[list(input()) for i in range(n)]
mod = 10**9 + 7
add = 0
ans = 0
for i in range(n - 1, 0, -1):
    add = (add + al[i]) % mod
    ans = (ans + add * al[i - 1]) % mod
print(ans)

-# a, b = map(int,input().split()) +# n, m = map(int, input().split()) -# l = [list(map(int,input().split())) for i in range(n)] +# al=[list(input()) for i in range(n)] -cuml = [al[0]] -for i in range(n - 2): -    cuml.append((cuml[i] + al[i + 1]) % mod) +add = 0 -for i in range(1, n): -    ans = (ans + cuml[i - 1] * al[i]) % mod +for i in range(n - 1, 0, -1): +    add = (add + al[i]) % mod +    ans = (ans + add * al[i - 1]) % mod