#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<long long> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  vector<long long> fac(n + 1), inv(n + 1);
  fac[0] = inv[0] = fac[1] = inv[1] = 1;
  for (long long i = 2; i <= n; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
  }
  long long ans = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 1; j < n - i - 1; j++) {
      ans = (ans + (x[i + j] - x[i]) * inv[j] % MOD * inv[j + 1] % MOD) % MOD;
    }
    ans = (ans + (x[n - 1] - x[i]) * inv[n - i - 1] % MOD) % MOD;
  }
  ans = ans * fac[n - 1] % MOD;
  cout << ans << "\n";
  return 0;
}
