class Integer
  def mod_pow(n, mod)
    x = self
    res = 1

    while n > 0
      res = res * x % mod if n[0] == 1
      x = x * x % mod
      n >>= 1
    end

    res
  end

  def mod_inverse(mod)
    mod_pow(mod - 2, mod)
  end
end

N = gets.to_i
A = gets.split.map(&:to_i)
MOD = 10 ** 9 + 7

RUI = []

k = 1

1.upto(N) do |i|
  k = k * i % MOD

  if i == 1
    RUI << i.mod_inverse(MOD)
  else
    RUI << RUI.last + i.mod_inverse(MOD)
  end
end

ans = 0

A.each_with_index do |a, i|
  r = 0

  r += RUI[i]
  r += RUI[N - i - 1]

  v = a * k * (r - 1.mod_inverse(MOD))

  ans += v.to_i
  ans %= MOD
end

puts ans
