#include <bits/stdc++.h>
using namespace std;
using ll = long long;
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;
}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
const ll mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<double> x(n);
  for (int i = 0; i < (n); i++) cin >> x[i];
  vector<ll> inv(n + 1), kai(n + 1);
  inv[1] = 1;
  for (int i = 2; i <= n; i++) {
    inv[i] = mod - (mod / i) * inv[mod % i] % mod;
  }
  kai[0] = 1;
  for (int i = 1; i <= n; i++) {
    kai[i] = kai[i - 1] * i % mod;
  }
  ll a = 0;
  ll ans = 0;
  for (int i = (1); i < (n); i++) {
    (a += kai[n - 1] * inv[i]) %= mod;
    (ans += a * (x[i] - x[i - 1])) %= mod;
  }
  cout << ans << endl;
  return 0;
}
