/* Author:zeke pass System Test! GET AC!! */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using ll = long long; using ld = long double; using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var)) #define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var)) #define Mp(a, b) make_pair((a), (b)) #define F first #define S second #define Icin(s) \ ll(s); \ cin >> (s); #define Scin(s) \ ll(s); \ cin >> (s); template bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } typedef pair P; typedef vector V; typedef vector VV; typedef vector

VP; ll mod = 1e9 + 7; ll MOD = 1e9 + 7; ll INF = 1e18; ll modpow(ll a, ll b) { if (b == 0) return 1; else if (b % 2 == 0) { ll d = modpow(a, b / 2) % MOD; return (d * d) % MOD; } else { return (a * modpow(a, b - 1)) % MOD; } } const int MAX_N = 100010; ll fact[MAX_N], finv[MAX_N]; ll comb(int n, int r) { if (n < r || r < 0) return 0; return fact[n] * finv[n - r] % MOD * finv[r] % MOD; } void calc(int n) { fact[0] = finv[0] = 1; for (int i = 1; i <= n; i++) { fact[i] = (fact[i - 1] * i) % MOD; finv[i] = modpow(fact[i], MOD - 2); } } int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin>>n; V vec(n); rep(i, n) cin >> vec[i]; ll sum=0; calc(1e5 + 1); rep(i,n){ sum += comb(n - 1, i) * vec[i] % MOD; sum %= MOD; } cout << sum << endl; }