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