from math import factorial as f n=int(input()) L=list(map(int,input().split())) a=0 for i in list(range(n)): a+=L[i]*f(n-1)//(f(n-1-i)*f(i)) print(a)