#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  double ans = 0;
  cin >> N;
  vector<double> C(N);
  vector<long long> X(N);
  for (long long i = 0; i < N; i++) cin >> X[i];
  C[0] = 1;
  for (long long i = 0; i < N - 1; i++) {
    double Y = X[i + 1] - X[i];
    Y *= C[i];
    C[i + 1] = C[i] + 1.0 / (i + 2.0);
    ans += Y;
  }
  long long k = 1;
  for (long long i = 0; i < N - 1; i++) {
    k *= (i + 1);
    k %= 1000000007;
  }
  ans *= k;
  long long p = ans;
  p %= 1000000007;
  cout << p << endl;
  return 0;
}
