#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MAX = 100005;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
int main() {
  COMinit();
  long long N;
  long long res = 0;
  cin >> N;
  vector<long long> x(N);
  vector<long long> d(N - 1);
  for (int i = 0; i < (N); ++i) cin >> x[i];
  for (int i = 0; i < (N - 1); ++i) d[i] = x[i + 1] - x[i];
  for (int i = 0; i < (N - 1); ++i) {
    for (int j = 0; j < (i + 1); ++j) {
      res += ((fac[N - 1] * d[i]) % MOD) * modinv(j + 1, MOD);
      res %= MOD;
    }
  }
  cout << res << endl;
  return 0;
}
