import itertools
N=int(input())
D=list(map(int,input().split()))
print(sum(d*cumulate for d,cumulate in zip(D[1:],itertools.accumulate(D)))) import itertools itertools 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 print(sum(d*cumulate for d,cumulate in zip(D[1:],itertools.accumulate(D)))) print sum(d*cumulate for d,cumulate in zip(D[1:],itertools.accumulate(D))) sum d*cumulate d cumulate D=list(map(int,input().split())) list(map(int,input().split())) D N=int(input()) int(input()) N
import itertools
N=int(input())
D=list(map(int,input().split()))
print(sum(d*cumulate for d,cumulate in zip(D[1:],itertools.accumulate(D))))