#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, mod = 1000000000 + 7, ans = 0, val = 1, a = 0, b = 0, m_ = 0;
  cin >> n;
  vector<long long> v(n, 0), p(n - 1, 0), f(n - 1, 0), d(n - 1, 0);
  for (long long(i) = 0; i < (n); ++(i)) cin >> v[i];
  for (long long(i) = 0; i < (n - 1); ++(i)) d[i] = v[i + 1] - v[i];
  p[0] = 1;
  for (long long i = 1; i < n - 1; ++i) {
    val *= i;
    val %= mod;
    p[i] = ((i + 1) * p[i - 1] + val) % mod;
  }
  f[0] = (val * (n - 1)) % mod;
  for (long long i = 1; i < n - 1; ++i) {
    a = 1, b = (i + 1) % mod, m_ = mod - 2;
    while (m_ != 0) {
      if (m_ & 1) a = (a * b) % mod;
      b = b * b % mod;
      m_ = m_ >> 1;
    }
    f[i] += (f[i - 1] * a) % mod;
  }
  for (long long i = 0; i < n - 1; ++i) ans += (d[i] * p[i] * f[i]) % mod;
  ans %= mod;
  cout << (ans) << endl;
  return 0;
}
