#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll MOD = pow(10LL, 9LL) + 7LL;
int main() {
  ll n;
  cin >> n;
  ll x[n];
  for (ll i = 0; i <= n - 1; i++) cin >> x[i];
  ll res = 1;
  ll porb = 0;
  ll ans = 0;
  for (ll i = 2; i <= n - 1; i++) {
    res *= i;
  }
  for (ll i = 0; i <= n - 2; i++) {
    porb += res / (i + 1);
    ans += (x[i + 1] - x[i]) * porb;
    ans %= MOD;
  }
  cout << ans << endl;
}
