#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int MAX_N = 100010;
long long fact[MAX_N], fact_inv[MAX_N], inv[MAX_N];
long long pow_mod(long long a, long long b) {
  long long ret;
  if (b < 0)
    ret = pow_mod(a, mod + b - 1);
  else if (b == 0)
    ret = 1;
  else if (b == 1)
    ret = a;
  else {
    long long c = pow_mod(a, b / 2);
    if (b % 2)
      ret = (c * c) % mod * a % mod;
    else
      ret = c * c % mod;
  }
  return ret;
}
void init(int x) {
  fact[0] = 1;
  fact[1] = 1;
  for (int i = 2; i <= x; ++i) fact[i] = fact[i - 1] * i % mod;
  fact_inv[x] = pow_mod(fact[x], -1);
  for (int i = x; i > 0; --i) fact_inv[i - 1] = fact_inv[i] * i % mod;
  for (int i = 1; i <= x; ++i) inv[i] = fact_inv[i] * fact[i - 1] % mod;
}
long long combi(long long a, long long b) {
  return fact[a] * fact_inv[b] % mod * fact_inv[a - b] % mod;
}
int main() {
  int n;
  cin >> n;
  vector<long long> x(n);
  for (int i = 0; i < n; ++i) cin >> x[i];
  init(100000);
  if (n > 2000) return 0;
  long long ans = 0;
  vector<long long> sum(n);
  for (int i = 0; i < n; ++i) sum[i] = inv[i];
  for (int i = 0; i < n - 1; ++i) sum[i + 1] += sum[i];
  for (int i = 0; i < n; ++i) (sum[i] *= fact[n - 1]) %= mod;
  for (int i = 1; i < n; ++i) (ans += (x[i] - x[i - 1]) * sum[i]) %= mod;
  cout << ans << endl;
}
