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)
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))
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)

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))

-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) +S = sum(A) +S2 = sum([x * x for x in A]) +print(((S * S - S2) // 2 % mod))