#include <bits/stdc++.h>
using namespace std;
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template <typename T>
void invec(vector<T>& A) {
  for (T& a : A) cin >> a;
}
vector<int64_t> factorialmod(int64_t n) {
  vector<int64_t> a(n + 1, 1);
  for (int64_t i = (1); i < (n + 1); ++i) a[i] = a[i - 1] * i % 1000000007LL;
  return a;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  VI x(N);
  invec(x);
  VI fac = factorialmod(N);
  i64 expect = 0;
  for (int64_t i = (1); i < (N + 1); ++i)
    (expect += (x[N - 1] - x[i - 1]) * fac[N - 1 - i + 1] % 1000000007LL) %=
        1000000007LL;
  cout << expect << endl;
}
