#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
}
int main() {
  long long mod_num = 1e9 + 7;
  int n;
  cin >> n;
  vector<long long> x(n);
  for (long long i = 0; i < (long long)(n); ++i) cin >> x[i];
  vector<long long> sabun(n - 1);
  for (long long i = (1); i < (long long)(n); ++i) {
    sabun[i - 1] = x[i] - x[i - 1];
  }
  long long kaijo = 1;
  for (int i = 1; i < n; i++) {
    kaijo = i * kaijo % mod_num;
  }
  long long ans = 0;
  long long kaijo_tmp = kaijo;
  for (long long i = 0; i < (long long)(n - 1); ++i) {
    long long tmp = kaijo_tmp * sabun[i] % mod_num;
    ans += tmp;
    kaijo_tmp += (kaijo / (i + 2)) % mod_num;
    kaijo_tmp %= mod_num;
  }
  cout << ans % mod_num << endl;
  return 0;
}
