#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chmax(T &x, T b) {
  if (x < b) {
    x = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &x, T b) {
  if (x > b) {
    x = b;
    return true;
  }
  return false;
}
const long long mod = 1e9 + 7;
const int inf = 1 << 30;
const int MAX = 2e6 + 1;
long long fac[MAX], finv[MAX], inv[MAX], sinv[MAX];
void cominit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  sinv[0] = 0, sinv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % mod;
    inv[i] = mod - inv[mod % i] * (mod / i) % mod;
    finv[i] = finv[i - 1] * inv[i] % mod;
    sinv[i] = sinv[i - 1] + inv[i] % mod;
  }
}
long long com(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
int main() {
  cominit();
  int n;
  cin >> n;
  vector<long long> x(n);
  for (int i = 0; i < (int)(n); i++) cin >> x[i];
  long long ans = 0;
  for (int i = 0; i < (int)(n - 1); i++) {
    ans += fac[n - 1] * (x[i + 1] - x[i]) % mod * sinv[i + 1] % mod;
    ans %= mod;
  }
  cout << ans << endl;
}
