#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1000000007;
const int nmax=1000010;
ll fac[nmax],finv[nmax],inv[nmax];
 
void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<nmax;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
}
int main(){
  ll n;cin >> n;
  COMinit();
  vector<ll> x(n);
  for(int i=0;i<n;i++){
    cin >> x[i];
  }
  ll sum=0,cnt=fac[n-1];
  for(ll i=0;i<n-1;i++){
    ll t=x[i+1]-x[i];
    sum+=(t*cnt)%mod;
    sum%=mod;
    cnt+=fac[n-1]*inv[i+2];
    cnt%=mod;
  }
  cout << sum << endl;
}