#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e9;
const int MAX_V = 100000 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);
long long fac[MAX_N];
long long fact(int n) {
  if (n == 1) return fac[n] = 1;
  if (fac[n]) return fac[n];
  return fac[n] = (fact(n - 1) * n) % MOD;
}
int main() {
  long long n;
  long long ans = 0;
  cin >> n;
  vector<long long> x(n);
  fact(n);
  for (int i = 0; i < (int)(n); i++) {
    cin >> x[i];
  }
  vector<long long> dist;
  for (int i = (1); i < (n); i++) {
    dist.push_back(x[i] - x[i - 1]);
  }
  for (int i = 0; i < (int)(n - 1); i++) {
    long long sum = 0;
    for (int j = 0; j < (int)(i + 1); j++) {
      sum += fact(n - 1) / (j + 1);
    }
    ans += (dist[i] * sum) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
