#include using namespace std; #define mod 1000000007 #define MAX_N 200010 long long inv[MAX_N]; long long factorial[MAX_N]; long long inv_factorial[MAX_N]; void GetInv(){ for (int i = 1; i < MAX_N; i++) { if (i == 1) inv[i] = 1; else { inv[i] = (mod - (mod / i) * inv[mod % i]) % mod; if (inv[i] < 0) inv[i] += mod; } } } void GetFactorial(){ factorial[0] = 1; inv_factorial[0] = 1; for (int i = 1; i < MAX_N; i++) { factorial[i] = factorial[i-1] * i; factorial[i] %= mod; inv_factorial[i] = inv_factorial[i-1] * inv[i]; inv_factorial[i] %= mod; } } long long combination(int n, int r) { long long ret = factorial[n] * inv_factorial[r]; ret %= mod; ret *= inv_factorial[n-r]; return ret % mod; } int main() { GetInv(); GetFactorial(); int n; cin >> n; long long ans = 0; for (int i = 0; i < n; i++) { long long c; cin >> c; ans = (ans + combination(n-1, i) * c % mod) % mod; } cout << ans << endl; return 0; }