N = int(eval(input()))

d = input().split()



sum = 0

for i in range(len(d)):

  for j in range(i+1, len(d)):

    sum = sum + int(d[i])*int(d[j])

    

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

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



sum = 0

for i in range(N):

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

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

    

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

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

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