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


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


ans = 0
for i in range(N):
    ans += d[i]*b[N-1-i]
print(ans)