#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long kaijo(long long n) {
  long long ans = 1;
  for (int i = 1; i <= n; i++) {
    ans *= i;
    ans %= mod;
  }
  return ans;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> x(n);
  for (int i = 0; i < n; ++i) cin >> x[i];
  vector<long long> y(n - 1);
  for (int i = 0; i < n - 1; ++i) y[i] = x[i + 1] - x[i];
  long long K = kaijo(n - 1);
  long long ans = y[0] * K;
  long long k = K;
  for (long long i = 1; i < n - 1; i++) {
    ans += y[i] * (K += k / (i + 1));
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
