#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;
using Complex = complex<double>;
const double PI = acos(-1);
int mod(ll a, int m) { return ((a % m) + m) % m; }
int main() {
  int N;
  cin >> N;
  vector<int> x(N), s(N);
  for (int i = 0; i < N; ++i) cin >> x[i];
  vector<ll> inv(N);
  inv[1] = 1;
  for (int i = 2; i < N; ++i) inv[i] = mod(-(MOD / i) * inv[MOD % i], MOD);
  ll fac = 1;
  for (int i = 2; i < N; ++i) fac *= i;
  for (int i = N - 2; i >= 0; --i) {
    s[i] = s[i + 1] + (x[i + 1] - x[i]);
    s[i] %= MOD;
  }
  ll ans = 0;
  for (int i = 0; i < N - 1; ++i) {
    ll c = (fac * inv[i + 1]) % MOD;
    ans += (s[i] * c) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
