#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
	cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll x[n],inv[n];
    for(int i=0;i<n;i++)inv[i]=1;
    for(int i=0;i<n;i++)cin>>x[i];
    for (int i=2;i<n;i++) {
        inv[i] = ll(mod-mod/i)*inv[mod%i]%mod;
    }
    ll ret = 0, sum = 0;
    for (int i = 0; i + 1 < n; ++i) {
        sum+=inv[i + 1];
        sum%=mod;
        ret+=(x[i+1]-x[i])*sum%mod;
    }
    ret%=mod;
    for (int i=1;i<n;i++)ret=ret*i%mod;
    cout << ret<<endl;
    return 0;
}
