#include <bits/stdc++.h>
using namespace std;
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;
}
const long long MOD = 1000000007;
const double PI = 3.1415926535897932;
long long n;
vector<long long> x;
long long solve() {
  cin >> n;
  x.resize(n);
  for (long long i = (0); i < (n); i++) {
    cin >> x[i];
  }
  long double ans = 0.0;
  long long modpow = 1;
  for (long long i = 1; i <= n - 1; i++) {
    modpow = (modpow * i) % (long long)(10e9 + 7);
  }
  for (long long i = n - 2; i >= 0; i--) {
    long long tmp = modpow % MOD;
    tmp *= modinv(i + 1, MOD);
    tmp %= MOD;
    ans += (long double)(x[n - 1] - x[i]) * tmp;
  }
  cout << (long long)ans % MOD << endl;
  return 0;
}
int main() {
  cout << std::fixed << std::setprecision(10);
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long end_solve = solve();
  return (int)end_solve;
}
