N=int(input()) A=[*map(int,input().split())] z=0 for i in range(N): z+=(i+1)*(N-i)*A[i] print(z)