n=int(input().split()) a=list(map(int,input().split())) print(sum([(min(i,n-i-1)*2+1)*a[i] for i in range(n)]))