N = int(eval(input()))

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

ans = 0

for i in range(N-1):

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

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

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

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

ans = 0

for i in range(N-1):

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

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

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

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

-d = list(map(int, input().split())) +D = list(map(int, input().split())) -        ans += d[i] * d[j] +        ans += D[i] * D[j]