n = int(input()) A = list(map(int, input().split())) mod = 10 ** 9 + 7 N = n + 5 bikkuri = [0 for i in range(N)] bikkuri[0] = 1 gyaku = [0 for i in range(N)] gyaku[0] = 1 for i in range(1, N): bikkuri[i] = (i * bikkuri[i - 1]) % mod gyaku[i] = pow(bikkuri[i], mod - 2, mod) def comb(n, r): if r < 0 or n - r < 0: return 0 return (bikkuri[n] * gyaku[r] * gyaku[n - r]) % mod temp = 0 for i in range(n): temp += comb(n - 1, (i + 1)) * A[i] temp %= mod print(temp)