#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll X = 1000000007;
int main() {
  ll N;
  cin >> N;
  vector<ll> x(N);
  for (ll i = 0; i < N; i++) {
    cin >> x.at(i);
  }
  vector<ll> d(N - 1);
  for (ll i = 0; i < N - 1; i++) {
    d.at(i) = x.at(i + 1) - x.at(i);
  }
  for (ll i = N - 3; i >= 0; i--) {
    d.at(i) += d.at(i + 1);
  }
  vector<ll> weight(N - 1, 1);
  for (ll i = 0; i < N - 1; i++) {
    for (ll j = 1; j < N; j++) {
      if (j != i + 1) {
        weight.at(i) *= j;
        weight.at(i) %= X;
      }
    }
  }
  ll ans = 0;
  for (ll i = 0; i < N - 1; i++) {
    ans += (d.at(i) * weight.at(i)) % X;
    ans %= X;
  }
  cout << ans << endl;
}
