#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;
template <class T>
bool chmax(T &a, const T &b) {
  if (b > a) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr ll mod = 1e9 + 7;
void solve() {
  ll n;
  cin >> n;
  vector<ll> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x.at(i);
  }
  vector<ll> d(n - 1);
  for (int i = 0; i < n - 1; i++) {
    d.at(i) = x.at(i + 1) - x.at(i);
  }
  for (int i = 1; i < n - 1; i++) {
    d.at(i) += d.at(i - 1);
    d.at(i) %= mod;
  }
  vector<ll> fact(n - 1);
  fact.at(0) = 1;
  for (ll i = 1; i < n - 1; i++) {
    fact.at(i) = fact.at(i - 1) * i;
    fact.at(i) %= mod;
  }
  ll ans = 0;
  ll S = d.at(n - 2);
  for (int i = 0; i < n - 1; i++) {
    ans += fact.at(n - 2 - i) * S % mod;
    ans %= mod;
    S *= (ll)(n - i - 1) % mod;
    S %= mod;
    ll tmp = i;
    ll cnt = tmp - 1;
    for (int j = 0; j < i; j++) {
      ll buf = tmp * fact.at(n - 3 - j);
      buf %= mod;
      buf *= d.at(j);
      buf %= mod;
      ans -= buf;
      ans %= mod;
      tmp *= cnt--;
      tmp %= mod;
    }
  }
  ans %= mod;
  if (ans < 0) ans += mod;
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}
