#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long fac(long long a) {
  long long sum = 1;
  for (long long i = 1; i <= a; ++i) {
    sum *= i;
    sum %= MOD;
  }
  return sum;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> x(n);
  for (long long i = 0; i < n; ++i) {
    cin >> x[i];
  }
  long double sum = 0;
  long double c = 0;
  for (long long i = 0; i < n - 1; ++i) {
    auto d = x[i + 1] - x[i];
    c += 1 / (long double)(i + 1);
    sum += (d * c);
    sum = fmodl(sum, MOD);
  }
  cout << long long(fmodl(sum * fac(n - 1), MOD)) << endl;
  return 0;
}
