#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll res=pow(x,y/2);
  res*=res;
  res%=mod;
  if(y%2==1) res*=x;
  return res%mod;
}
ll gyaku(ll x){
  return pow(x,mod-2);
}
vector<ll> frac,gfrac;
void set_frac(ll n){
  frac.push_back(1);
  gfrac.push_back(1);
  for(ll i=1;i<=n;i++){
    frac.push_back(frac[i-1]*i%mod);
    gfrac.push_back(gyaku(frac[i]));
  }
}
ll nCr(ll n,ll r){
  ll res=frac[n]*gfrac[r]%mod;
  res*=gfrac[n-r];
  return res%mod;
}
ll read(){
  ll res;
  cin>>res;
  return res;
}
int main(){
  ll n;
  cin>>n;
  vector<ll> vec;
  for(int i=0;i<n;i++) vec.push_back(read());
  ll ans=0,gsum=0;
  for(int i=0;i<n-1;i++){
    gsum+=gyaku(i+1);
    gsum%=mod;
    ans+=(gsum*(vec[i+1]-vec[i]))%mod;
    ans%=mod;
  }
  for(ll i=1;i<n;i++){
    ans*=i;
    ans%=mod;
  }
  cout<<ans<<endl;
}
