N=int(input()) a=list(map(int,input().split())) ans=0 b=[1 for i in range(N+1)] for i in range(1,N//2+1): b[i]=b[i-1]*(N-i)//i for i in range(N//2): ans+=(a[i]+a[N-1-i])*b[i] ans%=1000000007 if N%2==1: ans+=a[N//2]*b[N//2] print(ans % 1000000007)