M=10**9+7 s=i=0 x=1 N,*A=map(int,open(0).read().split()) for a in A:s+=a*x%M;i+=1;x=x*(N-i)//i print(s%M)