#include <bits/stdc++.h>
#define rep(i,l,r) for (int i=l,i##end=r;i<=i##end;++i)
#define ll long long
using namespace std;
const int N=1e6+6,P=1e9+7;
int inv[N],x[N];
int main(){
    int n; cin>>n;
    inv[1]=1; rep(i,2,n) inv[i]=(ll)inv[P%i]*(P-P/i)%P;
    rep(i,2,n) inv[i]=(inv[i-1]+inv[i])%P;
    rep(i,1,n) cin>>x[i];
    int ans=0;
    rep(i,1,n-1) ans=(ans+(ll)inv[i]*(x[i+1]-x[i]))%P;
    rep(i,1,n-1) ans=(ll)ans*i%P;
    cout<<ans<<endl;
    return 0;
}
