#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll mod=1e9+7;
ll inv(ll a){
    ll n=mod-2,ans=1;
    while(n>0){
        if(n&1) ans=ans*a%mod;
        n=n/2;
        a=a*a%mod;
    }
    return ans;
}
int main(){
    ll n,x[200001],ans=0,a=0,b=1,mod=1e9+7;
    cin>>n;
    rep(i,n) cin>>x[i];
    rep(i,n-1) (b*=i+1)%=mod;
    rep(i,n-1) a+=b*inv(i+1)%mod,(ans+=(x[i+1]-x[i])*a)%=mod;
    cout<<ans<<"\n";
}