#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,mod=1000000000+7,ans=0,val=1,a=0,b=0,m_=0;cin>>n;
  lvector v(n,0),p(n-1,0),f(n-1,0),d(n-1,0);
  rep(i,n) cin>>v[i];
  rep(i,n-1) d[i]=v[i+1]-v[i];
  p[0]=1;
  for(ll i=1;i<n-1;++i) {val=(val*i)%mod; p[i]=((i+1)*p[i-1]+val)%mod;}
  f[0]=(val*(n-1))%mod;
  for(ll i=1;i<n-1;++i) {
    a=1;b=(i+1)%mod;m_=mod-2;
    while(m_ != 0) {
      if(m_&1) a=(a*b)%mod;
      b=b*b%mod;
      m_=m_>>1;
    }
    f[i]+=(f[i-1]*a)%mod;
  }
  for(ll i=0;i<n-1;++i) ans+=(((d[i]*p[i])%mod)*f[i])%mod;
  ans%=mod;
  print(ans);
  return 0;
}