N = int(eval(input()))

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

mod = 10**9+7



fact = 1

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

    fact *= i

    fact %= mod



rev = [ pow((i),mod-2,mod) for i in range(1,N+1) ]

for i in range(N-1):

    rev[i+1] += rev[i]



ans = 0

for i in range(N):

    ans += A[i] * (fact * (rev[i] + rev[N-1-i] - rev[0])) % mod

    ans %= mod



print(ans)



N = int(eval(input()))

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

mod = 10**9+7



fact = 1

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

    fact *= i

    fact %= mod



rev = [ (pow((i),mod-2,mod)*fact)%mod for i in range(1,N+1) ]

for i in range(N-1):

    rev[i+1] += rev[i]

    rev[i+1] %= mod



ans = 0

for i in range(N):

    ans += A[i] * (rev[i] + rev[N-1-i] - rev[0]) % mod

    ans %= mod



print(ans)



N = int(eval(input()))
A = list(map(int, input().split(" ")))
mod = 10**9 + 7
fact = 1
for i in range(2, N + 1):
    fact *= i
    fact %= mod
rev = [pow((i), mod - 2, mod) for i in range(1, N + 1)]
for i in range(N - 1):
    rev[i + 1] += rev[i]
ans = 0
for i in range(N):
    ans += A[i] * (fact * (rev[i] + rev[N - 1 - i] - rev[0])) % mod
    ans %= mod
print(ans)

N = int(eval(input()))
A = list(map(int, input().split(" ")))
mod = 10**9 + 7
fact = 1
for i in range(2, N + 1):
    fact *= i
    fact %= mod
rev = [(pow((i), mod - 2, mod) * fact) % mod for i in range(1, N + 1)]
for i in range(N - 1):
    rev[i + 1] += rev[i]
    rev[i + 1] %= mod
ans = 0
for i in range(N):
    ans += A[i] * (rev[i] + rev[N - 1 - i] - rev[0]) % mod
    ans %= mod
print(ans)

-rev = [pow((i), mod - 2, mod) for i in range(1, N + 1)] +rev = [(pow((i), mod - 2, mod) * fact) % mod for i in range(1, N + 1)] +    rev[i + 1] %= mod -    ans += A[i] * (fact * (rev[i] + rev[N - 1 - i] - rev[0])) % mod +    ans += A[i] * (rev[i] + rev[N - 1 - i] - rev[0]) % mod