#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(int)(n);i++) #define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define all(x) (x).begin(),(x).end() #define pb push_back #define mp make_pair #define mt make_tuple typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; const int inf = 1LL<<60; const int mod = 1e9 + 7; const double eps = 1e-9; /*{ a b c d e a+b b+c c+d d+e a+2b+c b+2c+d c+2d+e a+3b+3c+d b+3c+3d+e a+4b+6c+4b+e }*/ template<int M> class Combination { public: int n; vector<int> fac, finv; Combination(int n_) : n(n_), fac(n_), finv(n_) { fac[0] = 1; for(int i = 1; i < n; i++) fac[i] = fac[i-1]*i%M; finv[n-1] = pow(fac[n-1], M-2); for(int i = n-1; i > 0; i--) finv[i-1] = finv[i]*i%M; } int pow(int a, int b) { if(b == 0) return 1; return pow(a*a%M, b/2)*(b%2?a:1)%M; } int C(int a, int b) { if(b < 0 or a < b) return 0; return fac[a]*finv[a-b]%M*finv[b]%M; } int P(int a, int b) { if(b < 0 or a < b) return 0; return fac[a]*finv[a-b]%M; } int H(int a, int b){ if(a == 0 and b == 0) return 1; return C(a+b-1, b); } }; signed main() { Combination<mod> comb(100010); int n; cin >> n; vi a(n); rep(i, n) cin >> a[i]; int ans = 0; rep(i, n){ ans += comb.C(n-1, i) * a[i] % mod; ans %= mod; } cout << ans << endl; return 0; }