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