import sys input=lambda: sys.stdin.readline().rstrip() n=int(input()) mod=10**9+7 A=[int(i) for i in input().split()] mod=10**9+7 n_max=2*(10**6+1) F,FI=[0]*(n_max+1),[0]*(n_max+1) F[0],FI[0]=1,1 for i in range(n_max): F[i+1]=(F[i]*(i+1))%mod FI[n_max-1]=pow(F[n_max-1],mod-2,mod) for i in reversed(range(n_max-1)): FI[i]=(FI[i+1]*(i+1))%mod def comb(x,y): return (F[x]*FI[x-y]*FI[y])%mod ans=0 for i,a in enumerate(A): ans=(ans+a*comb(n-1,i))%mod print(ans)