{-# LANGUAGE BangPatterns #-}

import Data.Int
import Data.Bits
import Data.List
import Data.IntMap.Strict (IntMap)
import qualified Data.IntMap.Strict as IntMap
import qualified Data.ByteString.Char8 as B
import Control.Monad
import Control.Applicative
import Data.Maybe
import qualified Data.IntMap.Strict as M
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as V
-- import Data.Vector.Unboxed ((!))
import Data.Tuple
import Data.Ord (Down(..))
import Data.Coerce


extEuc :: (Integral a) => a -> a -> (a,a,a)
extEuc x0 y0
  = loop (signum x0) 0 (abs x0) 0 (signum y0) (abs y0)
  where
    loop !a !b !x !c !d 0 = (a,b,x)
    loop !a !b !x !c !d !y
      = loop c d y (a - q*c) (b - q*d) z
      where
        (q,z) = x `quotRem` y

invMod :: (Integral a) => a -> a -> Maybe a
invMod x m
  | g == 1 = Just r'
  | otherwise = Nothing
  where
    (_,r,g) = extEuc m x
    r' = r `mod` m

modulus :: Int
modulus = 10^9 + 7

nMax :: Int
nMax = 10^5

plus :: Int -> Int -> Int
plus x y
  | p >= modulus = p - modulus
  | otherwise    = p
  where
    p = x + y

mult :: Int -> Int -> Int
mult x y = (x * y) `mod` modulus

fact :: Int -> Int
fact n = foldl' mult 1 [1..n]

sumInv :: V.Vector Int32
sumInv
  = V.map fromIntegral
    $ V.scanl' plus 0
    $ V.map (fromJust . (`invMod` modulus))
    $ V.enumFromN 1 nMax

coeff :: Int -> Int -> Int
coeff n j = x + y - 1
  where
    x = fromIntegral $ sumInv V.! (j+1)
    y = fromIntegral $ sumInv V.! (n-j)

query :: Int -> V.Vector Int -> Int
query n = V.foldl' plus 0 . V.imap (\j -> mult $ coeff n j `mult` fact n)

main :: IO ()
main = do
  n <- read <$> getLine
  v <- V.unfoldrN n (B.readInt . B.dropWhile (== ' ')) <$> B.getLine
  putStrLn $ show $ query n v
