#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll inv_mod(ll a, ll MOD) {
  ll b = MOD, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= MOD;
  if (u < 0) u += MOD;
  return u;
}
int main() {
  ll i, j;
  ll n;
  cin >> n;
  const ll MOD = 1e9 + 7;
  vector<ll> x(n);
  for (i = 0; i < n; ++i) cin >> x[i];
  vector<ll> inv(n - 1);
  for (i = 0; i < n - 1; ++i) {
    inv[i] = inv_mod(i + 1, MOD);
  }
  ll tmp = 1;
  for (i = 0; i < n - 1; ++i) {
    tmp *= (i + 1) % MOD;
  }
  vector<ll> bun(n - 1);
  for (i = 0; i < n - 1; ++i) bun[i] = tmp * inv[i] % MOD;
  vector<ll> wa(n - 1);
  wa[0] = bun[0];
  for (i = 0; i < n - 2; ++i) {
    wa[i + 1] = wa[i] + bun[i + 1];
    wa[i + 1] %= MOD;
  }
  ll ans = 0;
  for (i = 0; i < n - 1; ++i) {
    ans += (x[i + 1] - x[i]) * wa[i];
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
