#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
ll powm(ll x, ll k) {
  ll res = 1;
  while (k) {
    if (k & 1) res = res * x % MOD;
    k >>= 1;
    x = x * x % MOD;
  }
  return res;
}
ll modInv(ll x) { return powm(x, MOD - 2); }
int main() {
  int n;
  cin >> n;
  vector<ll> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  vector<ll> fact(n, 1);
  for (int i = 0; i + 1 < n; i++) fact[i + 1] = fact[i] * (i + 1);
  ll A = 0, B = 0, C = 0;
  for (int j = 1; j <= n - 2; j++) {
    A += fact[n - 1] * x[j] % MOD * (1 - modInv(j + 1)) % MOD;
    A %= MOD;
    A = (A % MOD + MOD) % MOD;
  }
  for (int i = 0; i <= n - 3; i++) {
    B += fact[n - 1] * x[i] % MOD * (1 - modInv(n - i - 1)) % MOD;
    B %= MOD;
  }
  for (int i = 0; i <= n - 2; i++) {
    C += fact[n - 1] * modInv(n - 1 - i) % MOD * (x[n - 1] - x[i]);
    C %= MOD;
  }
  ll res = A - B + C;
  res = (res % MOD + MOD) % MOD;
  cout << res << endl;
  return 0;
}
