mod = 1000000007 def add(a, b): return (a + b) % mod def sub(a, b): return (a + mod - b) % mod def mul(a, b): return ((a % mod) * (b % mod)) % mod def power(x, y): if y == 0 : return 1 elif y == 1 : return x % mod elif y % 2 == 0 : return power(x, y//2)**2 % mod else : return power(x, y//2)**2 * x % mod def div(a, b): return mul(a, power(b, mod-2)) 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]=div(mul(b[i-1],(N-i)),i) for i in range(N//2): ans+=mul(add(a[i],a[N-1-i]),b[i]) if N%2==1: ans+=mul(a[N//2],b[N//2]) print(ans % mod)