n = int(eval(input()))

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

MOD = (10**9+7)

ans = 0

nn = 0

for i in range(n):

  ans %= MOD

  ans += la[i]%MOD

  nn %= MOD

  nn += (la[i]**2)%MOD

ans = (ans**2-nn+10**9+7)*pow(2, -1, MOD)%MOD

print(ans)
n = int(eval(input()))

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

MOD = 10**9+7

s1 = sum(la)

s2 = sum([x**2 for x in la])

ans = (s1*s1-s2)//2%MOD

print(ans)
n = int(eval(input()))
la = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
nn = 0
for i in range(n):
    ans %= MOD
    ans += la[i] % MOD
    nn %= MOD
    nn += (la[i] ** 2) % MOD
ans = (ans**2 - nn + 10**9 + 7) * pow(2, -1, MOD) % MOD
print(ans)

n = int(eval(input()))
la = list(map(int, input().split()))
MOD = 10**9 + 7
s1 = sum(la)
s2 = sum([x**2 for x in la])
ans = (s1 * s1 - s2) // 2 % MOD
print(ans)

-ans = 0 -nn = 0 -for i in range(n): -    ans %= MOD -    ans += la[i] % MOD -    nn %= MOD -    nn += (la[i] ** 2) % MOD -ans = (ans**2 - nn + 10**9 + 7) * pow(2, -1, MOD) % MOD +s1 = sum(la) +s2 = sum([x**2 for x in la]) +ans = (s1 * s1 - s2) // 2 % MOD