n=int(eval(input()))

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

x=0

for i in range(n):

  x+=a[i]

x=x**2

y=0

for j in range(n):

  y+=a[j]**2

z=(x-y)//2

print((z%(10**9+7)))
n=int(eval(input()))

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

x=sum(a)**2

total=0

for i in range(n):

    total+=a[i]**2

y=int((x-total)//2)

print((y%(10**9+7)))
n = int(eval(input()))
a = list(map(int, input().split()))
x = 0
for i in range(n):
    x += a[i]
x = x**2
y = 0
for j in range(n):
    y += a[j] ** 2
z = (x - y) // 2
print((z % (10**9 + 7)))

n = int(eval(input()))
a = list(map(int, input().split()))
x = sum(a) ** 2
total = 0
for i in range(n):
    total += a[i] ** 2
y = int((x - total) // 2)
print((y % (10**9 + 7)))

-x = 0 +x = sum(a) ** 2 +total = 0 -    x += a[i] -x = x**2 -y = 0 -for j in range(n): -    y += a[j] ** 2 -z = (x - y) // 2 -print((z % (10**9 + 7))) +    total += a[i] ** 2 +y = int((x - total) // 2) +print((y % (10**9 + 7)))