n = int(input()) A = list(map(int, input().split())) ans = 0 for i, a in enumerate(A): if i == 0: ans += a*n elif i == n-1: ans += a*n else: ans += a*(i+1)*(n-1-i+1) print(ans)