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))#%(10**9+7)) x += 1 y -= 1 C.append(1) ans = 0 for a,c in zip(A,C) : ac = a*c ac %= 10**9+7 ans += ac ans %= 10**9+7 print(ans)