#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
const ll MAX = 510000;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; 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;
    }
}
void Main(){
    ll n;cin>>n;
    vector<ll> x(n);
    For(i,0,n) cin>>x[i];
    COMinit();
    vector<ll> acc(n+1,0);
    For(i,0,n) acc[i+1]=acc[i]+inv[i+1];
    For(i,0,n-1){
        ans+=(x[i+1]-x[i])*acc[i+1]%MOD;
        ans%=MOD;
    }
    ans*=fac[n-1];
    cout<<ans%MOD<<endl;
}
int main(){
    Main();
    return 0;
}