#Combinationクラス class Combination: def __init__(self, n, MOD): self.fact = [1] for i in range(1, n + 1): self.fact.append(self.fact[-1] * i % MOD) self.inv_fact = [pow(self.fact[i] ,MOD - 2 ,MOD) for i in range(n + 1)] self.MOD = MOD #i!を求める def factorial(self, i): return self.fact[i] #k!の逆元を求める def inverse_factorial(self, i): return self.inv_fact[i] #k_C_rを求める def combination(self, i, j): return (self.fact[i] * self.inv_fact[i - j] * self.inv_fact[j]) % self.MOD n = int(input()) a = list(map(int, input().split())) MOD = 10**9 + 7 comb = Combination(n, MOD) ans = 0 for i in range(n): ans += comb.combination(n-1, i) * a[i] ans %= MOD print(ans)