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