#include<bits/stdc++.h>
using namespace std;
#define int long
const int mod = 1000000007;
int gcd(int m,int n){return n?gcd(n,m%n):m;}
int lcm(int m,int n){return m/gcd(m,n)*n;}
signed main(){
  int n;
  cin>>n;
  vector<int> x(n);
  for(auto& i:x)cin>>i;
  vector<int> a(n),d(n),f(n);
  f[1]= a[1] = 1;
  for(int i=2;i<n;++i) f[i] = i*f[i-1]%mod;
  for(int i=1;i+1<n;++i) a[i+1] = ((i+1)*a[i]%mod+f[i])%mod;
  for(int i=1;i<n;++i) d[i] = x[i] - x[i-1];
  int res=0;
  for(int i=1;i<=n-2;++i){
    res = (res + a[i]*d[i]%mod)%mod;
    res = (res*(i+1))%mod;
  }
  res = (res + a[n-1]*d[n-1]%mod)%mod;
  cout<<res;
}