#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long int ll const MOD = 1000000007; ll const INF = (long long int)1 << 61; ll mypow(ll x,ll n){ ll ret = 1; while(n > 0){ if(n&1){ ret = (ret*x)%MOD; } x = (x*x)%MOD; n >>= 1; } return ret; } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vector a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } vector x(n+1,1); for(int i = 1; i < n+1; i++){ x[i] = (x[i-1]*(ll)i)%MOD; } ll ans = 0; for(int i = 0; i < n; i++){ ans += (a[i]*((x[n-1]*((mypow(x[i],MOD-2)*mypow(x[n-i-1],MOD-2))%MOD))%MOD) )%MOD; ans %= MOD; } cout << ans << endl; return 0; }