#include using namespace std; #define lint long long #define P pair #define LLP pair #define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i) #define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i) #define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i) #define SORT(x) sort((x).begin(), (x).end()) #define SORT_INV(x) sort((x).rbegin(), (x).rend()) const int IINF = 1e9 + 100; const long long LLINF = 2e18 + 129; const long long MOD = 1e9 + 7; const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1}; const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1}; const double EPS = 1e-8; long long power(long long x, long long n){ long long res = 1; x %= MOD; while(n > 0LL){ if(n & 1LL){ res *= x; res %= MOD; } x *= x; x %= MOD; n >>= 1; } return res; } int main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector a(n); rep(i, n){ cin >> a[i]; } vector fact(n), inv(n); fact[0] = 1; inv[0] = 1; REP(i, 1, n){ fact[i] = (lint)i * fact[i - 1]; fact[i] %= MOD; inv[i] = power(fact[i], MOD - 2); } lint ans = 0; rep(i, n){ ans += (((fact[n - 1] * ((inv[i] * inv[n - 1 - i]) % MOD)) % MOD) * a[i]) % MOD; ans %= MOD; } cout << ans << endl; return 0; }