#include <bits/stdc++.h>
using namespace std;

const int64_t mod = 1000000007;

int64_t power(int64_t n, int64_t k) {
  if (k == 0) return 1;
  int64_t half = power(n, k / 2), ans = half * half % mod;
  if (k % 2) {
    ans *= n;
    ans %= mod;
  }
  return ans;
}

int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; i++) cin >> x.at(i);
  int64_t fact = 1, ans = 0;
  for (int i = 1; i < n; i++) fact = fact * i % mod;
  vector<int64_t> s(n);
  for (int i = 1; i < n; i++) {
    s.at(i) = (s.at(i - 1) + power(i, mod - 2)) % mod;
  }
  for (int i = n - 1; i > 0; i--) {
    int64_t dx = x.at(i) - x.at(i - 1);
    ans += dx * s.at(i) % mod;
    ans %= mod;
  }
  cout << fact * ans % mod << endl;
}
