#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
const ll mod = 1e9+7;

void extgcd(ll a, ll b, ll &x, ll &y) {
  if(b == 0) {
    x = 1;
    y = 0;
    return;
  }
  extgcd(b, a%b, y, x);
  y -= a/b*x;
  return; 
}

ll mod_inverse(ll a, ll m) {
  ll x, y;
  extgcd(a,m,x,y);
  return (m + x % m) % m;
}

int main(){
  int n;
  cin >> n;
  ll x[n];
  rep(i,n) cin >> x[i];
  ll ans = 0;
  ll s = 0;
  for(ll i = 1; i < n; i++) {
    s += mod_inverse(i,mod);
    (ans += (x[i]-x[i-1])*s) %= mod;
  }
  for(ll i = 1; i < n; i++) (ans *= i) %= mod;
  cout << ans << endl;
  return 0;
}