// https://atcoder.jp/contests/agc028/tasks/agc028_b
//
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use std::fmt::*;
use std::io::*;
use std::str::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

const MOD: u64 = 1000000007;

struct Combination {
    fact: Vec<u64>,
    invfact: Vec<u64>,
}

impl Combination {
    fn inv(a: u64) -> u64 {
        Combination::pow(a, MOD - 2)
    }

    fn pow(a: u64, p: u64) -> u64 {
        let mut p = p;
        let mut aa = a;
        let mut ret = 1;
        while p >= 1 {
            if p & 1 == 1 {
                ret *= aa;
                ret %= MOD;
            }
            p >>= 1;
            aa = aa * aa % MOD;
        }
        ret
    }

    fn new(upto: usize) -> Self {
        let mut fact = vec![0; upto];
        let mut invfact = vec![0; upto];

        fact[0] = 1;
        for i in 1..upto {
            fact[i] = fact[i - 1] * (i as u64) % MOD;
        }

        invfact[upto - 1] = Combination::inv(fact[upto - 1]);
        invfact[0] = 1;
        for i in (1..upto - 1).rev() {
            invfact[i] = invfact[i + 1] * ((i + 1) as u64) % MOD;
        }

        Combination {
            fact: fact,
            invfact: invfact,
        }
    }

    fn comb(&self, n: usize, r: usize) -> u64 {
        if r < 0 || r > n {
            return 0;
        }
        self.fact[n] * self.invfact[r] % MOD * self.invfact[n - r] % MOD
    }
}

fn main() {
    input! {
        n: usize,
        a: [u64; n]
    };
    let ans = solve(a);
    println!("{}", ans);
}

fn solve(a: Vec<u64>) -> u64 {
    let n = a.len();
    let comb = Combination::new(100010);
    let mut prob_len = vec![0; n];
    for w in 1..n - 1 {
        prob_len[w] =
            Combination::inv((w + 1) as u64) * Combination::inv((w + 2) as u64) % MOD * 2 % MOD;
    }
    let mut prob_edge = vec![0; n + 1];
    for w in 1..n {
        prob_edge[w] = Combination::inv((w + 1) as u64);
    }
    prob_edge[n] = 1;

    let mut asum = vec![0; n + 1];
    for i in 0..n {
        let w = asum[i] + a[i];
        asum[i + 1] = w % MOD;
    }

    let mut ans = 0;
    // from edge
    for i in 1..n {
        let add = (asum[i] + asum[n] - asum[n - i] + MOD) % MOD * prob_edge[i] % MOD;
        ans += add;
    }
    ans %= MOD;

    // between
    {
        let mut l = (n - 1) / 2;
        let mut r = n / 2;
        let mut psum = 0;
        let mut vsum = 0;
        while l >= 1 {
            psum += prob_len[l];
            vsum += a[l];
            if l != r {
                psum += prob_len[r];
                vsum += a[r];
            }
            psum %= MOD;
            vsum %= MOD;
            ans += psum * vsum % MOD;
            ans %= MOD;
            l -= 1;
            r += 1;
        }
    }

    // first step
    ans += asum[n];

    ans %= MOD;
    ans *= comb.fact[n];
    ans %= MOD;

    ans
}


Measured memory_bytes: 10492