#include <bits/stdc++.h>
using namespace std;
const long long int LINF = 2000000000000000000ll;
const int INF = 1000000100;
const long long int MOD = 1e9 + 7;
struct mint {
  long long int x;
  mint(long long int x = 0) : x(x % MOD) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
};
const int MAX = 100005;
long long int fac[MAX], finv[MAX], inv[MAX];
void comb_init() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long int comb(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
  int n;
  cin >> n;
  vector<long long int> x(n);
  for (int i = 0; i < (n); ++i) cin >> x[i];
  vector<long long int> sum(n + 1, 0);
  for (int i = 0; i < (n); ++i) sum[i + 1] = sum[i] + x[i];
  mint ans = 0;
  mint f = 1;
  for (int i = 2; i < (n); ++i) f *= i;
  comb_init();
  for (int i = 0; i < (n - 1); ++i) {
    mint d = sum[n] - sum[i + 1] - (n - 1 - i) * x[i];
    d *= f;
    d *= inv[n - 1 - i];
    ans += d;
  }
  cout << ans.x << endl;
  return 0;
}
