#include <bits/stdc++.h>
const long INF = 1e9;
const long MOD = 1e9 + 7;
using namespace std;
template <class t>
using vc = vector<t>;
template <class t>
using vvc = vc<vc<t>>;
using pi = pair<long, long>;
using vi = vc<long>;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
long A[2000][2000];
long facctorialMethod(long k) {
  long sum = 1;
  for (long i = 1; i <= k; ++i) {
    sum = sum * i % MOD;
  }
  return sum;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
  long N;
  cin >> N;
  A[0][0] = 1;
  for (long i = long(0); i < long(1999); i++) {
    for (long j = long(0); j < long(i + 2); j++) {
      if (j == 0)
        A[i + 1][j] = (facctorialMethod(i + 1) + (i + 1) * A[i][0] % MOD) % MOD;
      else if (j == i + 1) {
        A[i + 1][j] =
            (facctorialMethod(i + 1) + ((i + 2) * A[i][j - 1]) % MOD) % MOD;
      } else
        A[i + 1][j] =
            (facctorialMethod(i + 1) + ((i + 2 - (j + 1)) * A[i][j]) % MOD +
             (A[i][j - 1] * (j + 1)) % MOD) %
            MOD;
    }
  }
  long d[N];
  for (long i = long(0); i < long(N); i++) {
    cin >> d[i];
  }
  long D[N - 1];
  for (long i = long(0); i < long(N - 1); i++) {
    D[i] = d[i + 1] - d[i];
  }
  long ans = 0;
  for (long i = long(0); i < long(N - 1); i++) {
    ans = (ans + (A[N - 2][i] * D[i]) % MOD) % MOD;
  }
  cout << ans << endl;
}
