#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using vi = vector<ll>;
using vvi = vector<vi>;
const ll MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vi x(N);
  for (auto& a : x) cin >> a;
  ;
  ll fact = 1;
  for (int i = 2; i < N; i++) fact = (fact * i) % MOD;
  vi cum_sum(N, 0);
  for (int i = 1; i < N; i++) cum_sum[i] = (cum_sum[i - 1] + fact / i) % MOD;
  ll total = 0;
  for (int i = 0; i < N - 1; i++)
    total = (total + ((x[i + 1] - x[i]) * cum_sum[i + 1]) % MOD) % MOD;
  cout << total << endl;
}
