#include using namespace std; typedef long long unsigned int ll; // definition {{{ 1 // scaning {{{ 2 #define Scd(x) scanf("%d", &x) #define Scd2(x,y) scanf("%d%d", &x, &y) #define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z) #define Scll(x) scanf("%llu", &x) #define Scll2(x,y) scanf("%llu%llu", &x, &y) #define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z) #define Scc(c) scanf("%c", &c); #define Scs(s) scanf("%s", s); #define Scstr(s) scanf("%s", &s); // }}} 2 // constants {{{ 2 #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) // }}} 2 // systems {{{ 2 #define Rep(x,y) for(int x = 0; x < y; x++) #define Repe(x,y,z) for(int x = z; x < y; x++) // }}} 2 // output {{{ 2 #define YesNo(a) (a)?printf("Yes\n"):printf("No\n"); // }}} 2 // }}} 1 ll mod = 1000000007; // PowMod( base, index, modulo) return base ** index % modulo {{{ // PowMod = base ** index % mod ( natural numbers ) long long unsigned int PowMod( long long unsigned int base, long long unsigned int index, long long unsigned int modulo = mod ){ if( index == 0 ) return 1; // O( log(index) ) if( index % 2 ){ return base * PowMod(base, index - 1, modulo) % modulo; }else{ long long unsigned int Phalf = index / 2; long long unsigned int half = PowMod(base, Phalf, modulo); return half * half % modulo; } } // }}} int main() { int N; Scd( N ); ll a[100023]; Rep(i,N){ Scll( a[i] ); } ll c; // (N-1)Ci c = 1; ll ans = 0; Rep(i,N){ ans += a[i]*c; ans %= mod; c = c * (N-i-1) * PowMod( i+1, mod-2 ) % mod; } printf ("%lld\n", ans ); return 0; }