#include <bits/stdc++.h>
using namespace std;
using vll = vector<long long>;
const long long mod = 1e9 + 7;
long long modpow(long long a, long long b, long long mod) {
  long long ans = 1 % mod;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b = b >> 1;
  }
  return ans;
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
long long factori(long long k) {
  long long tmp = k;
  if (k == 0) return 1;
  while (k > 1) {
    k--;
    tmp = tmp * k % mod;
  }
  return tmp;
}
int main() {
  long long N;
  cin >> N;
  vll x(N);
  for (int i = 0; i < (int)(N); i++) cin >> x[i];
  vll dist(N - 1);
  for (int i = 0; i < (int)(N - 1); i++) dist[i] = x[i + 1] - x[i];
  long long ans =
      factori(N - 1) % mod * (accumulate(dist.begin(), dist.end(), 0ll)) % mod;
  for (int i = 0; i < (int)(N - 1); i++) {
    if (i == 0) continue;
    ans += dist[i] * (N - 1 - i) % mod * i % mod *
           (((N - 1) * (N - 2) / 2) % mod) * factori(N - 3) % mod;
    ans %= mod;
  }
  cout << ans << endl;
}
