#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
vector<long long> X;
long long N;
void modinvs(long long N, vector<long long>& inv, vector<long long>& sinv,
             long long mod = 1e9 + 7) {
  inv.resize(N + 1);
  sinv.resize(N + 1);
  inv[1] = 1;
  sinv[0] = 1;
  sinv[1] = 1;
  for (int n = 2; n <= N; n++) {
    inv[n] = mod - (inv[mod % n] * (mod / n)) % mod;
    sinv[n] = (sinv[n - 1] * inv[n]) % mod;
  }
}
vector<long long> inv, sinv, st;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> N;
  X.resize(N + 1);
  for (long long n = 1; n <= N; n++) cin >> X[n];
  modinvs(N, inv, sinv, MOD);
  long long ans = 0;
  long long Q = 0;
  st.resize(N + 1, 1);
  for (long long n = 2; n <= N; n++) {
    st[n] = (st[n - 1] * n) % MOD;
  }
  for (long long n = 1; n <= N - 1; n++) {
    long long temp = ((st[N - 1] + Q) * (X[n] - X[n - 1])) % MOD;
    ans += temp;
    if (n == N - 1) break;
    long long q = st[N - 2 - n];
    q = (q * inv[n + 1]) % MOD;
    q = (q * st[N - 1]) % MOD;
    q = (q * sinv[N - n - 2]) % MOD;
    Q = (Q + q) % MOD;
  }
  cout << ans % MOD << "\n";
  return 0;
}
