$MOD = 1000000007

def pow(a, b)
  ret = 1
  while b > 0
    if b % 2 != 0
      ret = (ret * a) % $MOD
    end
    a = (a * a) % $MOD
    b /= 2
  end
  return ret
end

n = gets.to_i
a = gets.chomp.split.map(&:to_i)

fact = 1
fact_inv_sum = Array.new(n+1, 0)
for i in 1..n
  fact = fact * i % $MOD
  fact_inv_sum[i] = pow(i, $MOD-2) + fact_inv_sum[i-1]
  fact_inv_sum[i] %= $MOD
end

ans = 0
for i in 0...n
  c = (fact_inv_sum[n-i] + fact_inv_sum[i+1] - 1 + $MOD) % $MOD;
  ans += c * a[i]
  ans %= $MOD
end

puts (fact * ans) % $MOD