from functools import reduce
from itertools import accumulate
from math import gcd
n=int(input())
L=list(map(int,input().split()))
print(sum(d*cumulate for d,cumulate in zip(L[1:],accumulate(L)))) from functools import reduce from itertools import accumulate from math import gcd n=int(input()) n int(input()) int input() input L=list(map(int,input().split())) L 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(L[1:],accumulate(L)))) print sum(d*cumulate for d,cumulate in zip(L[1:],accumulate(L))) sum d*cumulate d cumulate n=int(input()) int(input()) n L=list(map(int,input().split())) list(map(int,input().split())) L
from functools import reduce
from itertools import accumulate
from math import gcd
n=int(input())
L=list(map(int,input().split()))
print(sum(d*cumulate for d,cumulate in zip(L[1:],accumulate(L))))
