#include <bits/stdc++.h>
using namespace std;
const long long INF = numeric_limits<long long>::max() / 4;
const long long MOD = 1e9 + 7;
const int n_max = 1e5 + 10;
void print() { cout << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << ' ';
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T>& vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << ' ';
  }
  cout << endl;
}
template <class T>
void print(vector<vector<T>>& df) {
  for (auto& vec : df) {
    print(vec);
  }
}
const long long MAX = 1e5 + 10;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  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 COM(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;
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> x(n);
  for (long long i = 0; i < (long long)(n); i++) cin >> x[i];
  long long ans = 0;
  vector<long long> dp(n + 10, 0);
  dp[0] = 1;
  for (long long i = 0; i < (long long)(n); i++)
    dp[i + 1] = dp[i] * (i + 1) % MOD;
  vector<long long> dp2(n + 10);
  dp2[0] = 0;
  for (long long i = 0; i < (long long)(n + 1); i++) {
    dp2[i + 1] = (dp2[i] * (i + 1)) % MOD + (dp[i + 1] / (i + 1));
    dp2[i + 1] %= MOD;
  }
  for (long long i = 0; i < (long long)(n - 1); i++) {
    long long dis = x[i + 1] - x[i];
    long long temp = dp2[i + 1];
    temp = (temp * (dp[n - 1] * modinv(dp[i + 1], MOD)) % MOD) % MOD;
    temp %= MOD;
    ans = (ans + (temp * dis) % MOD) % MOD;
  }
  cout << ans << endl;
}
