import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum mod = 10L^^9 + 7;

void main() {
    int n;
    scan(n);
    auto a = readln.split.to!(long[]);

    auto r = new long[](n + 1);
    foreach (i ; 1 .. n + 1) {
        r[i] = pow(i, mod - 2, mod);
    }

    foreach (i ; 1 .. n + 1) {
        r[i] += r[i-1];
        r[i] %= mod;
    }

    debug {
        writeln(r);
    }

    long ans;

    long nf = 1;
    foreach (i ; 2 .. n + 1) {
        nf *= i;
        nf %= mod;
    }

    foreach (i ; 0 .. n) {
        long p = r[i+1] + r[n - i];
        p %= mod;
        p += mod - 1;
        p %= mod;
        ans += (nf * p) % mod * a[i] % mod;
        ans %= mod;
    }

    writeln(ans);
}


long pow(long x, long y, long mod) {
    return y > 0 ? pow(x, y>>1, mod)^^2 % mod * x^^(y&1) % mod : 1L;
}





















void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}