#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 1000, OO = 1e14 + 100, M = 1e9 + 7, P = 6151,
                SQ = 120, lg = 31;
long long dp[N], a[N];
long long fac[N], inv[N];
long long pw(long long x, long long y) {
  if (y == 0) return 1;
  long long cnt = pw(x, y / 2);
  cnt = (cnt * cnt) % M;
  cnt = (cnt * (y % 2 == 1 ? x : 1)) % M;
  return cnt;
}
void prepro() {
  fac[0] = 1;
  for (long long i = 1; i <= N - lg; i++) fac[i] = (fac[i - 1] * i) % M;
  inv[N - lg] = pw(fac[N - lg], M - 2);
  for (long long i = N - lg - 1; i > -1; i--)
    inv[i] = (inv[i + 1] * (i + 1)) % M;
}
long long c(long long x, long long y) {
  return ((fac[x] * inv[y] % M) * inv[x - y]) % M;
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  prepro();
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  dp[n] = 0;
  for (long long i = n - 1; i > 0; i--) {
    long long m = (n - i);
    dp[i] = (dp[i + 1] * m) % M;
    long long sum = 0;
    for (long long j = 0; j < m; j++) {
      long long t = a[i + j + 1] - a[i + j];
      dp[i] = (dp[i] + (((fac[m] - sum) % M + M) % M) * t) % M;
      if (j == m - 1) break;
      long long h = (c(m, j + 2) * fac[j]) % M;
      h = (h * fac[m - j - 2]) % M;
      sum = (sum + h) % M;
    }
  }
  cout << dp[1] << endl;
  return 0;
}
