r = 1000000007

N = 100000

l = [1]*N



def egcd(a, b):

    (x, lastx) = (0, 1)

    (y, lasty) = (1, 0)

    while b != 0:

        q = a // b

        (a, b) = (b, a % b)

        (x, lastx) = (lastx - q * x, x)

        (y, lasty) = (lasty - q * y, y)

    return (lastx, lasty, a)



# ax ≡ 1 (mod m)

def modinv(a, m):

    (inv, q, gcd_val) = egcd(a, m)

    return inv % m



for i in range(1,N):

    l[i] = l[i-1]+modinv(i+1,r)



N = int(eval(input()))

A = list(map(int,input().split()))



exp = 0

for i in range(N):

    exp += (l[i]+l[N-i-1]-1)*A[i]%r



ans = exp

for i in range(1,N+1):

    ans = ans*i%r

print(ans)
N = int(eval(input()))

A = list(map(int,input().split()))

mod = 10**9+7

def inv(n):

	n %= mod

	return pow(n,mod-2,mod)

	

H = [0]*(N+1)

for n in range(1,N+1):

	H[n] = (inv(n)+H[n-1])%mod



N_f = 1

for n in range(1,N+1):

	N_f = N_f*n%mod



ans = 0

for n in range(1,N+1):

	ans += A[n-1]*(H[N-n+1]+H[n]-1)

	ans %= mod



ans *= N_f

ans %= mod

print(ans)
r = 1000000007
N = 100000
l = [1] * N


def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)


# ax ≡ 1 (mod m)
def modinv(a, m):
    (inv, q, gcd_val) = egcd(a, m)
    return inv % m


for i in range(1, N):
    l[i] = l[i - 1] + modinv(i + 1, r)
N = int(eval(input()))
A = list(map(int, input().split()))
exp = 0
for i in range(N):
    exp += (l[i] + l[N - i - 1] - 1) * A[i] % r
ans = exp
for i in range(1, N + 1):
    ans = ans * i % r
print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7


def inv(n):
    n %= mod
    return pow(n, mod - 2, mod)


H = [0] * (N + 1)
for n in range(1, N + 1):
    H[n] = (inv(n) + H[n - 1]) % mod
N_f = 1
for n in range(1, N + 1):
    N_f = N_f * n % mod
ans = 0
for n in range(1, N + 1):
    ans += A[n - 1] * (H[N - n + 1] + H[n] - 1)
    ans %= mod
ans *= N_f
ans %= mod
print(ans)

-r = 1000000007 -N = 100000 -l = [1] * N +N = int(eval(input())) +A = list(map(int, input().split())) +mod = 10**9 + 7 -def egcd(a, b): -    (x, lastx) = (0, 1) -    (y, lasty) = (1, 0) -    while b != 0: -        q = a // b -        (a, b) = (b, a % b) -        (x, lastx) = (lastx - q * x, x) -        (y, lasty) = (lasty - q * y, y) -    return (lastx, lasty, a) +def inv(n): +    n %= mod +    return pow(n, mod - 2, mod) -# ax ≡ 1 (mod m) -def modinv(a, m): -    (inv, q, gcd_val) = egcd(a, m) -    return inv % m - - -for i in range(1, N): -    l[i] = l[i - 1] + modinv(i + 1, r) -N = int(eval(input())) -A = list(map(int, input().split())) -exp = 0 -for i in range(N): -    exp += (l[i] + l[N - i - 1] - 1) * A[i] % r -ans = exp -for i in range(1, N + 1): -    ans = ans * i % r +H = [0] * (N + 1) +for n in range(1, N + 1): +    H[n] = (inv(n) + H[n - 1]) % mod +N_f = 1 +for n in range(1, N + 1): +    N_f = N_f * n % mod +ans = 0 +for n in range(1, N + 1): +    ans += A[n - 1] * (H[N - n + 1] + H[n] - 1) +    ans %= mod +ans *= N_f +ans %= mod