#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(i,k,n) for(int i = (k); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pdd;
 

int main(){
    ll n,mod=1000000007;
    cin>>n;
    vector<ll> dist(n-1);
    ll a,b;cin>>a;
    rep(i,n-1){
        cin>>b;
        dist[i]=b-a;
        a=b;
    }
    ll ans=dist[0];
    ll ex=1,ls=1;
    rept(i,2,n){
        ex=ex*(i-1)%mod;
        ls =(ls*i+ex)%mod;
        ans = (ans*i+dist[i-1]*ls)%mod;
    }
    cout<<ans<<endl;
    return 0;
}