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)

n = int(eval(input()))

mod = int(1e9+7)

ans, t = 0, 0

for a in list(map(int, input().split())):

    ans = (ans+a*t) % mod

    t = (t + a) % mod



print(ans)

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)

n = int(eval(input()))
mod = int(1e9 + 7)
ans, t = 0, 0
for a in list(map(int, input().split())):
    ans = (ans + a * t) % mod
    t = (t + a) % mod
print(ans)

-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) +mod = int(1e9 + 7) +ans, t = 0, 0 +for a in list(map(int, input().split())): +    ans = (ans + a * t) % mod +    t = (t + a) % mod