N = int(eval(input()))

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

A_sum = sum(A[1:])



tot = 0

for i in range(N-1):

    tot += (A[i]*A_sum)%(10**9+7)

    tot = tot%(10**9+7)

    A_sum -= A[i+1]

    

print(tot)
N = int(eval(input()))

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



s = [0]*(N+1)

for i in range(N):

    s[i+1] = s[i] + A[i]

    

cnt = 0

for j in range(N):

    cnt =  (cnt + (A[j]*(s[N] - s[j+1])))%(10**9+7)

print(cnt)
N = int(eval(input()))
A = list(map(int, input().split()))
A_sum = sum(A[1:])
tot = 0
for i in range(N - 1):
    tot += (A[i] * A_sum) % (10**9 + 7)
    tot = tot % (10**9 + 7)
    A_sum -= A[i + 1]
print(tot)

N = int(eval(input()))
A = list(map(int, input().split()))
s = [0] * (N + 1)
for i in range(N):
    s[i + 1] = s[i] + A[i]
cnt = 0
for j in range(N):
    cnt = (cnt + (A[j] * (s[N] - s[j + 1]))) % (10**9 + 7)
print(cnt)

-A_sum = sum(A[1:]) -tot = 0 -for i in range(N - 1): -    tot += (A[i] * A_sum) % (10**9 + 7) -    tot = tot % (10**9 + 7) -    A_sum -= A[i + 1] -print(tot) +s = [0] * (N + 1) +for i in range(N): +    s[i + 1] = s[i] + A[i] +cnt = 0 +for j in range(N): +    cnt = (cnt + (A[j] * (s[N] - s[j + 1]))) % (10**9 + 7) +print(cnt)