#include <bits/stdc++.h>
using namespace std;
int T, n;
const int maxn = 1e5 + 5;
const long long MOD = 1e9 + 7;
long long x[maxn];
long long a[maxn];
long long e[maxn];
long long fac[maxn];
long long inv[maxn];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  inv[1] = 1ll;
  for (int i = 2; i < maxn; ++i)
    inv[i] = (MOD - (MOD / i) * inv[MOD % i] % MOD) % MOD,
    assert(inv[i] * i % MOD == 1);
  cin >> n;
  fac[0] = 1ll;
  for (int i = (0); i < (n); ++i)
    cin >> x[i], fac[i + 1] = (fac[i] * (i + 1) % MOD) % MOD;
  for (int i = (1); i < (n); ++i) a[i] = x[i] - x[i - 1];
  e[1] = 1ll;
  long long sum = (e[1] * a[1]) % MOD;
  for (int i = (2); i < (n); ++i) {
    e[i] = ((long long(i) + 1ll) % MOD * inv[2]) % MOD;
    sum += (e[i] * a[i]) % MOD;
    sum %= MOD;
  }
  sum = (sum * fac[n - 1]) % MOD;
  cout << sum << endl;
  return 0;
}
