#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ina(x,n) rep(x_i,n) cin>>x[x_i]

typedef long long ll;
typedef vector<ll> vl;

const int MOD = 1e9+7;

ll power(ll a, ll b) {
  ll res = 1, base = a;
  while (b > 0) {
    if (b & 1) (res *= base) %= MOD;
    (base *= base) %= MOD;
    b >>= 1;
  }
  return res;
}

int main() {
  int n; cin >> n;
  vl x(n); ina(x,n);
  ll ans = 0, c = 0;
  rep(i,n-1) {
    c += power(i+1, MOD-2);
    c %= MOD;
    ans += c * (x[i+1] - x[i]);
    ans %= MOD;
  }
  rep(i,n-1) {
    ans *= (i+1);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
