#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long mod2 = 998244353;
const long long INF = 1e18;
const long double EPS = 1e-10;
int main() {
  long long n;
  cin >> n;
  vector<long long> x(n);
  for (long long i = 0; i < (n); ++i) cin >> x[i];
  vector<long long> com(n, 1);
  long long comb = 1;
  for (int i = (1); i < (n); ++i) {
    comb = (comb * i) % mod;
    com[i] = comb;
  }
  long long sum = 0;
  for (long long i = 0; i < (n - 1); ++i) sum = (sum + x[i]) % mod;
  long long ans = (comb * sum) % mod;
  ans = (mod - ans) % mod;
  sum = 0;
  for (int i = (n - 2); i >= (1); --i) {
    sum = (sum + x[i]) % mod;
    long long res = com[n - 2];
    res = (res * sum) % mod;
    ans = (ans + res) % mod;
  }
  sum = (sum + x[1] + x[n - 1]) % mod;
  comb = (com[n - 2] * (n - 2)) % mod;
  sum = (comb * sum) % mod;
  ans = (ans + sum) % mod;
  long long res = (com[n - 1] * (x[n - 1] + x[1])) % mod;
  ans = (ans + res) % mod;
  cout << ans << endl;
  return 0;
}
