#include <bits/stdc++.h>
using namespace std;
template <class S, class T>
pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first + t.first, s.second + t.second);
}
template <class S, class T>
pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first - t.first, s.second - t.second);
}
template <class S, class T>
ostream &operator<<(ostream &os, pair<S, T> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long inf = 1000000001;
const long long INF = (long long)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
long long dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
long long dx2[8] = {1, 1, 0, -1, -1, -1, 0, 1},
          dy2[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long MOD = 1000000007;
long long f(long long n) {
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) {
    a[i] = i;
  }
  long long res = 0;
  do {
    set<long long, greater<long long>> st;
    for (long long i = 0; i < (n); i++) st.insert(a[i]);
    long long x = *st.begin();
    long long cnt = 1;
    for (long long i = 0; i < (n); i++) {
      st.erase(a[i]);
      if (i != n - 1 and x == a[i]) {
        x = *st.begin();
        cnt++;
      }
    }
    res += cnt;
  } while (next_permutation(a.begin(), a.end()));
  return res;
}
const long long MAXN = 200010;
vector<long long> fact(MAXN);
vector<long long> rfact(MAXN);
long long mod_pow(long long x, long long p, long long M = MOD) {
  if (p < 0) {
    x = mod_pow(x, M - 2, M);
    p = -p;
  }
  long long a = 1;
  while (p) {
    if (p % 2) a = a * x % M;
    x = x * x % M;
    p /= 2;
  }
  return a;
}
long long mod_inverse(long long a, long long M = MOD) {
  return mod_pow(a, M - 2, M);
}
void set_fact(long long n, long long M = MOD) {
  fact[0] = fact[1] = rfact[0] = rfact[1] = 1;
  for (long long i = 2; i <= n; i++) {
    fact[i] = i * fact[i - 1] % M;
  }
}
long long nCr(long long n, long long r, long long M = MOD) {
  if (r > n) return 0;
  assert(fact[2] == 2);
  long long ret = fact[n];
  if (rfact[r] == 0) {
    rfact[r] = mod_inverse(fact[r], M);
  }
  ret = (ret * rfact[r]) % M;
  if (rfact[n - r] == 0) {
    rfact[n - r] = mod_inverse(fact[n - r], M);
  }
  ret = (ret * rfact[n - r]) % M;
  return ret;
}
long long nHr(long long n, long long r) { return nCr(n + r - 1, r); }
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ;
  long long n;
  cin >> n;
  vector<long long> x(n);
  for (long long i = 0; i < (n); i++) cin >> x[i];
  set_fact(n + 1);
  vector<long long> f(n + 1);
  f[0] = 0;
  f[1] = 1;
  for (long long i = 1; i < n; i++) {
    f[i + 1] = (f[i] * (i + 1) % MOD + fact[i]) % MOD;
  }
  long long ans = 0;
  for (long long i = 1; i <= (n - 1); i++) {
    ans +=
        f[i] * (x[i] - x[i - 1]) % MOD * fact[n - i - 1] * nCr(n - 1, i) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
