N = int(input()) A = list(map(int,input().split())) C = 1 x = 1 y = N-1 ans = A[0] + A[-1] for i in range(1,N-1) : C = (C * y // x) x += 1 y -= 1 ans += A[i]*C ans %= 10**9+7 print(ans)