n = int(input())
d = list(map(lambda x: int(x), input().split(" ")))
ans = 0
for i in range(n - 1):
  ans += d[i] * sum(d[i + 1:])
  
print(ans)
73d2cffae018f4ee3e6b3605bbc5eb17ef895fc2
<mask token>

<mask token>
for i in range(n - 1):
    ans += d[i] * sum(d[i + 1:])
print(ans)

n = int(input())
d = list(map(lambda x: int(x), input().split(' ')))
ans = 0
for i in range(n - 1):
    ans += d[i] * sum(d[i + 1:])
print(ans)

n = int(input())
d = list(map(lambda x: int(x), input().split(" ")))
ans = 0
for i in range(n - 1):
  ans += d[i] * sum(d[i + 1:])
  
print(ans)