n = int(eval(input()))

l = eval(input())

a = l.split(' ')



tmp = 0

total2 = 0



for i in range(n):

    tmp += int(a[i])



for i in range(n):

    total2 += int(a[i])*(tmp-int(a[i]))

    tmp -= int(a[i])



print((total2%1000000007))



n = int(eval(input()))

l = eval(input())

a = l.split(' ')



tmp = 0

tmp2 = 0



for i in range(n):

    tmp += int(a[i])



for i in range(n):

    tmp2 += int(a[i])*int(a[i])



print((int((tmp*tmp-tmp2)//2)%1000000007))
n = int(eval(input()))
l = eval(input())
a = l.split(" ")
tmp = 0
total2 = 0
for i in range(n):
    tmp += int(a[i])
for i in range(n):
    total2 += int(a[i]) * (tmp - int(a[i]))
    tmp -= int(a[i])
print((total2 % 1000000007))

n = int(eval(input()))
l = eval(input())
a = l.split(" ")
tmp = 0
tmp2 = 0
for i in range(n):
    tmp += int(a[i])
for i in range(n):
    tmp2 += int(a[i]) * int(a[i])
print((int((tmp * tmp - tmp2) // 2) % 1000000007))

-total2 = 0 +tmp2 = 0 -    total2 += int(a[i]) * (tmp - int(a[i])) -    tmp -= int(a[i]) -print((total2 % 1000000007)) +    tmp2 += int(a[i]) * int(a[i]) +print((int((tmp * tmp - tmp2) // 2) % 1000000007))