#include <bits/stdc++.h>
using namespace std;
const unsigned long long mod = (unsigned long long)1e9 + 7;
int main(void) {
  long long n;
  cin >> n;
  vector<long long> xs(n);
  for (int i = 0; i < n; i++) cin >> xs[i];
  vector<long long> dist(n - 1);
  for (int i = 0; i < n - 1; i++) dist[i] = xs[i + 1] - xs[i];
  vector<double> expDist(n);
  for (long long i = 1; i < n; i++) {
    expDist[i] = 1.0 / i;
  }
  vector<double> expDistSum(n, 0);
  for (long long i = 1; i < n; i++) {
    expDistSum[i] = expDistSum[i - 1] + expDist[i];
  }
  long long mul = 1;
  for (long long i = 1; i < n; i++) {
    mul *= i;
    mul %= mod;
  }
  double sum = 0;
  for (int i = 0; i < n - 1; i++) {
    double elem = dist[i] * expDistSum[i + 1];
    sum += elem * mul;
    sum -= ((long long)(sum / mod)) * mod;
  }
  cout << (long long)(sum + 0.5) << endl;
  return 0;
}
