#include <bits/stdc++.h>
constexpr int MOD = 1000000007;
using ll = long long;
using namespace std;
ll f[100010];
void init() {
  f[0] = 1;
  for (int i = 1; i < 100010; i++) f[i] = (f[i - 1] * i) % MOD;
}
int main() {
  init();
  int n;
  cin >> n;
  if (n > 2000) return 0;
  vector<ll> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  vector<ll> dp(n);
  dp[0] = f[n - 1];
  for (int i = 1; i < n - 1; i++) {
    ll sum = dp[0];
    for (int j = 0; j < i; j++) sum += dp[0] / (i + 1 - j);
    dp[i] = sum;
  }
  ll total = 0;
  for (int i = 0; i < n - 1; i++) {
    total += dp[i] * (x[i + 1] - x[i]);
    total %= MOD;
  }
  cout << total << endl;
  return 0;
}
