#include <bits/stdc++.h>
#define mod 1000000007
#define rep(i,n) for(int i=0;(i)<(n);i++)
typedef long long ll;
using namespace std;
ll fact(ll n,ll skip){
    if(n<=1) return 1;
    else if(n==skip) return fact(n-1,skip);
    else return ((n%mod)*fact(n-1,skip))%mod;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll modinv(ll a) {
    return modpow(a, mod - 2);
}
int main(void){
    ll n; cin >> n;
    ll x[100000];
    rep(i,n) cin >> x[i];
    ll p[100000]; p[0] = fact(n-1,0);
    rep(i,n-2){
        p[i+1] = (p[i] + p[0]*modinv(i+2))%mod;
    }
    ll ans = 0;
    rep(i,n-1){
        ans = (ans + ((x[i+1]-x[i]) * p[i])%mod)%mod;
    }
    cout << ans << endl;
}

