#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<n;i++)
using namespace std;
typedef long long ll;

const ll MOD = 1e+9 + 7;


ll modpow(ll x, ll n){
    ll res = 1;
    ll mul = x;
    while(n){
        if(n % 2) res = res * mul % MOD;
        mul = mul * mul % MOD;
        n /= 2;
    }
    return res;
}

ll modinv(ll x, ll n){
    return modpow(x, n - 2);
}

int main(){
    ll n;
    cin >> n;
    vector<ll> x(n);
    for(int i = 0; i < n; i++) cin >> x[i];
    ll ans = 0;
    ll r = 0;
    for(int i = 1; i < n; i++){
        r = (r + modinv(i, MOD)) % MOD;
        ans = (ans + r * (x[i] - x[i - 1]) % MOD) % MOD;
    }
    for(int i = 1; i < n; i++) ans = (ans * i) % MOD;
    cout << ans << endl;
}