#include <bits/stdc++.h>
using ll = long long;
constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};
template <typename T>
void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <typename T>
void chmin(T& a, T b) {
  a = std::min(a, b);
}
template <typename T>
void chadd(T& a, T b) {
  a = a + b;
}
namespace {
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
std::vector<std::pair<long long, long long> > prime_factorize(long long n) {
  std::vector<std::pair<long long, long long> > res;
  for (long long p = 2; p * p <= n; ++p) {
    if (n % p != 0) continue;
    int num = 0;
    while (n % p == 0) {
      ++num;
      n /= p;
    }
    res.push_back(std::make_pair(p, num));
  }
  if (n != 1) res.push_back(std::make_pair(n, 1));
  return res;
}
const int MAX = 2100000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[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;
  }
}
ll 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;
}
}  // namespace
int main() {
  ll n;
  std::cin >> n;
  std::vector<ll> x(n);
  for (int i = 0; i < n; ++i) std::cin >> x[i];
  COMinit();
  std::vector<ll> fact(n, 1);
  for (int i = 2; i < n; ++i) {
    fact[i] = fact[i - 1] * i;
    fact[i] %= mod;
  }
  ll ans = 0;
  std::vector<ll> c(n);
  c[0] = fact[n - 1];
  for (int i = 0; i < n - 1; ++i) {
    ll dist = x[i + 1] - x[i];
    ans += dist * c[i];
    ans %= mod;
    c[i + 1] = c[i] + fact[n - 1] / (i + 2);
  }
  std::cout << ans << std::endl;
  return 0;
}
