#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll Mod = 1000000007LL;
vector<ll> fac(1, 0LL);
vector<ll> facsig(1, 1LL);
void fact(ll n) {
  ll v = 1;
  for (ll i = 1; i <= n; ++i) {
    v *= i;
    v %= Mod;
    fac.emplace_back(v);
    ll sig = ((i + 2) * (i + 1)) % Mod / 2;
    facsig.emplace_back((v * sig) % Mod);
  }
}
int main() {
  ll n;
  cin >> n;
  vector<ll> x(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  --n;
  fact(n);
  ll ans = 0;
  vector<ll> rui(1, fac[n]);
  for (int i = n - 2; i >= 0; --i) {
    ll t = facsig[i];
    rui.emplace_back((t * fac[n - i - 1]) % Mod);
  }
  for (int i = 1; i < n; ++i) {
    rui[i] += rui[i - 1];
    rui[i] %= Mod;
  }
  for (int i = 0; i < n; ++i) {
    ans += ((x[i + 1] - x[i]) * rui[i]) % Mod;
    ans %= Mod;
  }
  cout << ans << endl;
  return 0;
}
