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