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