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

inv = Array.new(n+1)
inv[1] = 1
fac = Array.new(n+1)
fac[0] = fac[1] = 1
# f_inv = Array.new(n + 1)
# f_inv[0] = f_inv[1] = 1
(2..n).each do |i|
  inv[i] = inv[MOD%i] * (MOD - MOD/i) % MOD
  fac[i] = fac[i-1] * i % MOD
  # f_inv[i] = f_inv[i - 1] * inv[i] % MOD
end

#累積和
(1..n-1).each do |i|
  inv[i+1] = (inv[i+1] + inv[i]) % MOD
end

p_inv = 0
n.times do |i|
  m = inv[i+1] + inv[n-i] - inv[1]
  p_inv = (p_inv + m * a[i] % MOD) % MOD
end
 
puts p_inv * fac[n] % MOD