N = int(eval(input()))

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

inf = 10**9+7

aa = [0]*N



for i in range(N):

  aa[i] = A[i]**2

X = sum(A)**2 - sum(aa)

print(((X//2)%inf))
N = int(eval(input()))

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

sa = sum(A)

INF = 10**9+7

ans = 0

for i in range(N):

  sa -= A[i]

  ans += (A[i]*sa)%INF

print((ans%INF))
N = int(eval(input()))
A = list(map(int, input().split()))
inf = 10**9 + 7
aa = [0] * N
for i in range(N):
    aa[i] = A[i] ** 2
X = sum(A) ** 2 - sum(aa)
print(((X // 2) % inf))

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

-inf = 10**9 + 7 -aa = [0] * N +sa = sum(A) +INF = 10**9 + 7 +ans = 0 -    aa[i] = A[i] ** 2 -X = sum(A) ** 2 - sum(aa) -print(((X // 2) % inf)) +    sa -= A[i] +    ans += (A[i] * sa) % INF +print((ans % INF))