n=int(eval(input()))

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



c=0

for i in range(n):

    for j in range(i+1,n):

        c+=d[i]*d[j]

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

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



ans=0

for i in range(n):

      for j in range(i+1,n):

            ans+=L[i]*L[j]

print(ans)
n = int(eval(input()))
d = list(map(int, input().split()))
c = 0
for i in range(n):
    for j in range(i + 1, n):
        c += d[i] * d[j]
print(c)

n = int(eval(input()))
L = list(map(int, input().split()))
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        ans += L[i] * L[j]
print(ans)

-d = list(map(int, input().split())) -c = 0 +L = list(map(int, input().split())) +ans = 0 -        c += d[i] * d[j] -print(c) +        ans += L[i] * L[j] +print(ans)