N =int(input()) A =[int(i)for i in input().split()] def cmb(n,r,mod): if (r<0 or r>n): return 0 r = min(r,n-r) #n!/(r!(n-r)!) return g1[n]*g2[r]*g2[n-r] %mod #nCrのmod mod = 10**9+7 g1 =[1,1] #i番目=i!の元 g2 =[1,1] #i番目=i!の逆元 inverse =[0,1] #i番目=iの逆元 for i in range(2,N+1): g1.append(g1[-1]*i %mod) #i!の元の追加 inverse.append(-inverse[mod % i] * (mod//i) % mod) #???(iの逆元を計算してるはず) g2.append((g2[-1]*inverse[-1])%mod) ans = 0 for i in range((N+1)//2): a =A[i] +A[N-1-i] ans += a * cmb(N-1,i,mod) % mod if N%2==1: n = N//2 ans -= A[n] * cmb(N-1,n,mod) % mod print(ans%mod)