#include <bits/stdc++.h>
using namespace std;
template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& x : vec) {
    is >> x;
  }
  return is;
}
int mod = 1000000007;
struct modint {
  long long x;
  modint(long long x) : x(x % mod) {}
  modint& operator+=(const modint a) {
    (x += a.x) %= mod;
    return *this;
  }
  modint& operator-=(const modint a) {
    (x -= a.x) %= mod;
    if (x < 0) x += mod;
    return *this;
  }
  modint& operator*=(const modint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  modint& operator/=(modint a) {
    long long exp = mod - 2;
    while (exp > 0) {
      if (exp & 1) *this *= a.x;
      a *= a.x;
      exp >>= 1;
    }
    return *this;
  }
  modint operator+(const modint a) const {
    modint res(*this);
    return res += a;
  }
  modint operator-(const modint a) const {
    modint res(*this);
    return res -= a;
  }
  modint operator*(const modint a) const {
    modint res(*this);
    return res *= a;
  }
  modint operator/(const modint a) const {
    modint res(*this);
    return res /= a;
  }
};
modint modpow(modint x, long long n) {
  modint res = 1;
  while (n > 0) {
    if (n & 1) res = res * x.x;
    x = x * x;
    n >>= 1;
  }
  return res;
}
const int NMAX = 500000;
long long fact[NMAX], finv[NMAX], inv[NMAX];
void ncr_init() {
  fact[0] = fact[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < NMAX; i++) {
    fact[i] = fact[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
}
long long ncr(int n, int r) {
  if (n < r) return 0;
  if (n < 0 || r < 0) return 0;
  return fact[n] * (finv[n - r] * finv[r] % 1000000007) % 1000000007;
}
long long sigpr[NMAX];
long long sig_init() {
  sigpr[0] = 0;
  for (int i = 1; i <= NMAX - 1; i++) {
    sigpr[i] = (sigpr[i - 1] + inv[i]) % 1000000007;
  }
}
int main() {
  modint ans = 0;
  long long tmp;
  int n;
  cin >> n;
  vector<long long> x(n);
  cin >> x;
  ncr_init();
  sig_init();
  for (int i = 0; i < n - 1; i++) ans += (x[i + 1] - x[i]) * sigpr[i + 1];
  ans *= fact[n - 1];
  cout << ans.x << endl;
}
