import Data.Vector (Vector, (!))
import qualified Data.Vector as V

main = do
  n <- readLn
  as <- map read.words <$> getLine
  print $ solve n as

solve n as = foldr1 (+%) $ zipWith (*%) as $ map (*%nf) ps
  where
  nf = foldr1 (*%) [1..n]
  ps = [invsum!(n+1-i) + invsum!i - 1 | i <- [1..n]]
  inv x = u where (u,_,_) = euc x mo
  invsum = V.fromListN (n+1) $ scanl (+%) 0 $ map inv [1..n]


mo = 1000000007

infixl 7 *%
a *% b = a * b `mod` mo

infixl 6 +%
a +% b = (a + b) `mod` mo

infixl 6 -%
a -% b = (a-b+mo) `mod` mo

euc = go 1 0 0 1
  where
  go u v u' v' x 0 = (u,v,x)
  go u v u' v' x y = go u' v' (u - q * u') (v - q * v') y r
    where (q,r) = quotRem x y