#include #include #include #include #include #include #include #include #include static const int MOD = 1000000007; using ll = int64_t; using u32 = uint32_t; using namespace std; template constexpr T INF = ::numeric_limits::max()/32*15+208; template T pow_ (T x, T n, T M){ uint64_t u = 1, xx = x; while (n > 0){ if (n&1) u = u * xx % M; xx = xx * xx % M; n >>= 1; } return static_cast(u); }; template class Factorial { T mod; vector facts, factinv; public: Factorial(int n, T mod) : facts(static_cast(n+1)), factinv(static_cast(n+1)), mod(mod) { facts[0] = 1; for (int i = 1; i < n+1; ++i) facts[i] = facts[i-1]*i % mod; factinv[n] = pow_(facts[n], static_cast(mod - 2), static_cast(mod)); for (int i = n-1; i >= 0; --i) factinv[i] = factinv[i+1] * (i+1) % mod; } T fact(int k) const { if(k >= 0) return static_cast(facts[k]); else return static_cast(factinv[-k]); } T operator[](const int &k) const { if(k >= 0) return static_cast(facts[k]); else return static_cast(factinv[-k]); } T C(int p, int q) const { if(q < 0 || p < q) return 0; return static_cast(facts[p]* factinv[q] % mod * factinv[p-q] % mod); } T P(int p, int q) const { if(q < 0 || p < q) return 0; return static_cast((facts[p] * factinv[p-q]) % mod); } T H(int p, int q) const { if(p < 0 || q < 0) return 0; return static_cast(q == 0 ? 1 : C(p+q-1, q)); } }; int main() { int n; cin >> n; ll ans = 0; Factorial f(n, MOD); for (int i = 0; i < n; ++i) { ll x; cin >> x; (ans += x*f.C(n-1, i)) %= MOD; } cout << ans << "\n"; return 0; }