#include <bits/stdc++.h>

using namespace std;
#define rep(i, n) for(int i = 0 ; i < (int)(n) ; i++)
typedef long long ll;
typedef long double Double;

#ifndef INPUTS_DIR
#define INPUTS_DIR "./"
#endif

using namespace std;
const int mod = 1000000007;

template<int M = mod, bool IsPrime = false>
class Modulo {
    int n;

    static typename std::enable_if<IsPrime, ll>::type inv(ll a, ll p) {
        return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
    }

public:
    Modulo() : n(0) { ; }

    Modulo(int m) : n(m) {
        if (n >= M)
            n %= M;
        else if (n < 0)
            n = (n % M + M) % M;
    }

    Modulo(ll m) {
        if (m >= M)
            m %= M;
        else if (m < 0)
            m = (m % M + M) % M;
        n = m;
    }

    explicit operator int() const { return n; }

    explicit operator ll() const { return n; }

    bool operator==(const Modulo &a) const { return n == a.n; }

    Modulo &operator+=(const Modulo &a) {
        n += a.n;
        if (n >= M) n -= M;
        return *this;
    }

    Modulo &operator-=(const Modulo &a) {
        n -= a.n;
        if (n < 0) n += M;
        return *this;
    }

    Modulo &operator*=(const Modulo &a) {
        n = (ll(n) * a.n) % M;
        return *this;
    }

    Modulo operator+(const Modulo &a) const {
        Modulo res = *this;
        return res += a;
    }

    Modulo operator-(const Modulo &a) const {
        Modulo res = *this;
        return res -= a;
    }

    Modulo operator-() const { return Modulo(0) - *this; }

    Modulo operator*(const Modulo &a) const {
        Modulo res = *this;
        return res *= a;
    }

    Modulo operator^(int m) const {
        if (m == 0) return Modulo(1);
        const Modulo a = *this;
        Modulo res = (a * a) ^(m / 2);
        return m % 2 ? res * a : res;
    }

    typename std::enable_if<IsPrime, Modulo>::type
    operator/(const Modulo &a) const {
        return *this * inv(ll(a), M);
    }

    typename std::enable_if<IsPrime, Modulo>::type operator/=(const Modulo &a) {
        return *this *= inv(ll(a), M);
    }
};

template<int M, bool IsPrime = false>
bool is_zero(Modulo<M, IsPrime> x) {
    return int(x) == 0;
}

template<int M, bool IsPrime = false>
int abs(Modulo<M, IsPrime> x) {
    return int(x);
}


template<int M = mod>
Modulo<M, true> fact(int n, bool sw = true) {
    static std::vector<Modulo<M, true>> v1 = {1}, v2 = {1};
    if (n >= (int) v1.size()) {
        const int from = v1.size(), to = n + 1024;
        v1.reserve(to);
        v2.reserve(to);
        for (int i = from; i < to; ++i) {
            v1.push_back(v1.back() * Modulo<M, true>(i));
            v2.push_back(v2.back() / Modulo<M, true>(i));
        }
    }
    return sw ? v1[n] : v2[n];
}

template<int M = mod>
Modulo<M, true> comb(int a, int b) {
    if (b < 0 || b > a) return 0;
    return fact<M>(a, true) * fact<M>(b, false) * fact<M>(a - b, false);
}

using Mod = Modulo<mod, true>;


Mod S[200020];
Mod SS[200020];

Mod f(int s) {
    if (s == 0) return 0;
    return S[s - 1];
}

Mod F(int s) {
    if (s == 0) return 0;
    return SS[s - 1];
}

void solve(int N, vector<ll> A) {
    for (int i = 0; i < A.size(); i++)
        S[i] = ((i ? S[i - 1] : 0) + A[i]);

    for (int i = 0; i <= A.size(); i++)
        SS[i] = ((i ? SS[i - 1] : 0) + f(i));

    Mod ans = 0;
    for (int k = 1; k < N; k++) {
        Mod sub = F(N) - F(k + 1);
        sub -= F(N - k) - F(1);

        ans += sub * fact(2) * fact(k) * comb(N, N - 2 - k) * fact(N - 2 - k);
        ans += f(k) * fact(k) * comb(N, N - 1 - k) * fact(N - 1 - k);
        ans += (f(N) - f(N - k)) * fact(k) * comb(N, N - 1 - k) * fact(N - 1 - k);
    }
    ans += f(N) * fact(N);
    cout << (int) ans << endl;
}

void main_(istream &cin) {
    ll N;
    cin >> N;
    vector<ll> A(N - 1 + 1);
    for (int i = 0; i <= N - 1; i++) {
        cin >> A[i];
    }
    solve(N, A);
}

int main() {
#ifdef INTELLIJ
    ifstream ifs(string(INPUTS_DIR) + "in_1.txt");
    if (ifs.is_open()) {
        main_(ifs);
        ifs.close();
    } else {
        cerr << "Error: no input." << endl;
    }
#else
    ios::sync_with_stdio(false);
    cin.tie(0);
    main_(cin);
#endif
}





Measured memory_bytes: 4224