#include <bits/stdc++.h>

#ifdef HOME
#define db(x) cerr << #x << " = " << x << endl
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")" << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
#define dbv(a) cerr << #a << " = "; for (auto xxx: a) cerr << xxx  << " "; cerr << endl
#else
#define db(x) ;
#define db3(x, y, z) ;
#define db2(x, y) ;
#define dbv(a) ;
#endif

using namespace std;
typedef long long ll;
typedef double dbl;

/*
const ll SZ = 2e9;
char buf[SZ];
ll csz;
void *operator new(size_t sz) {
    assert(csz + sz < SZ);
    void *res = buf + csz;
    csz += sz;
    return res;
}
void operator delete(void*) {}
void operator delete(void*, size_t) {}*/

# 1 "lib/math/mod_utils.h"
# 1 "/home/izban/Contests/cp-algos//"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "lib/math/mod_utils.h"


namespace mod {
    typedef long long ll;
    const int MOD = (int)1e9 + 7;

    void add(int &a, ll b) {
        a = (a + b) % MOD;
    }

    int mul(int a, int b) {
        return 1LL * a * b % MOD;
    }

    int bin(int a, ll n) {
        int res = 1;
        while (n) {
            if (n & 1) res = 1LL * res * a % MOD;
            a = 1LL * a * a % MOD;
            n >>= 1;
        }
        return res;
    }

    int inv(int x) {
        return bin(x, MOD - 2);
    }

    vector<int> fct, ofct, rev;

    void ensureFact(int n) {
        if ((int)fct.size() > n) return;
        int old = fct.size();
        fct.resize(n + 1);
        ofct.resize(n + 1);
        rev.resize(n + 1);
        if (old == 0) {
            fct[0] = ofct[0] = 1;
            rev[0] = 0;
            old++;
        }
        for (int i = old; i <= n; i++) {
            fct[i] = mul(fct[i - 1], i);
            if (i == 1) rev[i] = 1;
            else rev[i] = (MOD - mul(MOD / i, rev[MOD % i])) % MOD;
            ofct[i] = mul(ofct[i - 1], rev[i]);
        }
    }

    int getC(int n, int k) {
        if (n < k || k < 0) return 0;
        ensureFact(n);
        return mul(fct[n], mul(ofct[k], ofct[n - k]));
    }
}
using namespace mod;

int main() {
#ifdef HOME
    assert(freopen("in", "r", stdin));
#endif

    int n;
    while (cin >> n) {
        vector<int> a(n);
        for (int i = 0; i < n; i++) cin >> a[i];

        ensureFact(2 * n + 10);

        // i was counted for j? in i..j j is first deleted
        //sum j=0..n-1: n! / (i-j)! * C(n!, (i-j)!) = n! / (i-j)! * n! / (i-j)! / (n-(i-j))!
        // C(n, (i-j+1)) * (n-(i-j+1))!
        // n! / (i-j+1)!

        int ans = 0;
        for (int it = 0; it < 2; it++) {
            int sum = 0;
            for (int i = 0; i < n; i++) {
                add(sum, rev[i + 1]);
                //add(sum, mul(ofct[i + 1], mul(ofct[i + 1], ofct[n - i])));
            }

            for (int i = 0; i < n; i++) {
                int csum = mul(sum, fct[n]);
                //db2(i, csum);
                add(ans, mul(csum, a[i]));
                //add(ans, mul(mul(sum, mul(fct[n], fct[n])), a[i]));
                add(sum, MOD - rev[n - i]);
            }
            reverse(a.begin(), a.end());
        }
        for (int i = 0; i < n; i++) add(ans, MOD - mul(fct[n], a[i]));
        cout << ans << endl;

/*
        ans = 0;
        vector<int> p(n);
        iota(p.begin(), p.end(), 0);
        map<pair<int, int>, int> mp;
        do {
            vector<int> r(n);
            for (int i = 0; i < n; i++) r[p[i]] = i;
            for (int i =0 ; i  < n; i++) {
                for (int j = 0; j < n; j++) {
                    bool ok = 1;
                    for (int t = min(i, j); t <= max(i, j); t++) {
                        ok &= r[t] >= r[i];
                    }
                    if (ok) {
                        add(ans, a[j]);
                        mp[make_pair(i, j)]++;
                        //if (i == 0 && j == 2) dbv(p);
                    }
                }
            }
        } while (next_permutation(p.begin(), p.end()));
        for (auto it : mp) db3(it.first.first, it.first.second, it.second);
        cout << ans << endl;

        break;*/
    }

#ifdef HOME
    cerr << "time: " << clock() * 1.0 / CLOCKS_PER_SEC << endl;
#endif
}


Measured memory_bytes: 2944