def inv(x): return pow(x, MOD-2, MOD) def C(n, r): return fact[n] * inv(fact[r]) * inv(fact[n-r]) N = int(input()) a = list(map(int, input().split())) MOD = 10 ** 9 + 7 fact = [1] for i in range(1, N+1): fact.append(fact[-1] * i % MOD) ans = 0 for i in range(N): ans += C(N-1, i) * a[i] ans %= MOD print(ans)