N = int(input())
d = list(map(int, input().split()))
S = [d[0]]
for i in range(N-1):
  S.append(S[i] + d[i+1])
ans = 0
for j in range(N-1):
  ans += d[j+1] * S[j]
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 = [d[0]] S [d[0]] d[0] d 0 for i in range(N-1):
  S.append(S[i] + d[i+1]) i range(N-1) range N-1 N 1 S.append(S[i] + d[i+1]) S.append S append S[i] + d[i+1] S[i] S i d[i+1] d i+1 i 1 ans = 0 ans 0 for j in range(N-1):
  ans += d[j+1] * S[j] j range(N-1) range N-1 N 1 ans += d[j+1] * S[j] ans d[j+1] * S[j] d[j+1] d j+1 j 1 S[j] S j print(ans) print ans ans += d[j+1] * S[j] d[j+1] * S[j] ans S = [d[0]] [d[0]] S ans = 0 0 ans d = list(map(int, input().split())) list(map(int, input().split())) d N = int(input()) int(input()) N
N = int(input())
d = list(map(int, input().split()))
S = [d[0]]
for i in range(N-1):
  S.append(S[i] + d[i+1])
ans = 0
for j in range(N-1):
  ans += d[j+1] * S[j]
print(ans)