let rec power ( * ) e m n =
  if n <= 0 then e
  else power ( * ) (if n land 1 = 0 then e else m * e) (m * m) (n lsr 1)

let m = 1000000007
let ( +^ ) x y = (x + y) mod m
let ( *^ ) x y = (x * y) mod m

let inv x = power ( *^ ) 1 x (m - 2)
let perm n k =
  Array.fold_left ( *^ ) 1 @@
  Array.init k @@ ( + ) @@ n - k + 1

let () = Scanf.scanf "%d\n" @@ fun n ->
  let ps = Array.make n 0 in
  for i = 0 to n - 1 do
    ps.(0) <- inv (1 + i) + ps.(0)
  done;
  for i = 1 to n - 1 do
    ps.(i) <- ps.(i - 1) + inv (1 + i) - inv (1 + n - i)
  done;
  Printf.printf "%d\n" @@
    ( *^ ) (perm n n) @@
      Array.fold_left ( +^ ) 0 @@
        Array.init n @@ fun i ->
          Scanf.scanf "%d " @@ fun a -> a *^ ps.(i)
