#include using namespace std; typedef long long ll; typedef pair pii; #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);++i) const ll mod=1000000007; ll f[100001],rf[100001]; ll inv(ll x){ ll ret=1; ll k=mod-2; ll y=x; while(k){ if(k&1) ret=ret*y%mod; y=y*y%mod; k/=2; } return ret; } void init(){ f[0]=1; for(int i=1;i<=100000;++i) f[i]=f[i-1]*i%mod; rep(i,100001) rf[i]=inv(f[i]); } ll calc(int n,int k){ ll a=f[n]; ll b=rf[n-k]; ll c=rf[k]; ll bc=b*c%mod; return a*bc%mod; } int main(){ cin.tie(0); ios::sync_with_stdio(false); int n;cin >> n; vector a(n); rep(i,n) cin >> a.at(i); ll ans=0; init(); rep(i,n){ ans+=calc(n-1,i)*a.at(i)%mod; } cout << ans << endl; }