#include <bits/stdc++.h>
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
using namespace std;
constexpr int MOD = 1000000007;
int mod(int a) {
  int res = a % MOD;
  if (res < 0) {
    return res + MOD;
  }
  return res;
}
int mul_mod(int a, int b) {
  long long res = ((long long)a * (long long)b) % MOD;
  return mod((int)res);
}
int pow_mod(int a, int b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * (long long)a % (long long)MOD;
    }
    a = mul_mod(a, a);
    b >>= 1;
  }
  return (int)res;
}
int inv_mod(int a) { return pow_mod(a, MOD - 2); }
int div_mod(int a, int b) { return mul_mod(a, inv_mod(b)); }
constexpr int FAC_MAX = 200001;
long long fac[FAC_MAX], finv[FAC_MAX], inv[FAC_MAX];
void com_init() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < FAC_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;
  }
}
long long com_mod(int a, int b) {
  if (a < b) return 0;
  if (a < 0 || b < 0) return 0;
  return fac[a] * (finv[b] * finv[a - b] % MOD) % MOD;
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0, i_len = (n); i < i_len; ++i) cin >> x[i];
  com_init();
  int k = fac[n - 1], l = 1, ans = 0;
  for (int i = 0, i_len = (n - 1); i < i_len; ++i) {
    ans = mod(ans + mul_mod(k, (x[i + 1] - x[i])));
    42;
    l++;
    k += div_mod(fac[n - 1], l);
  }
  cout << ans << "\n";
  return 0;
}
