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

const ll mod = 1000000007;

ll modpow(ll a, ll b)
{
    ll c = 1;
    while (b > 0)
    {
        if (b & 1)
            c = a * c % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return c;
}

ll kaijou(ll n)
{
    if (n <= 1)
        return 1;
    else
        return (n * kaijou(n - 1)%mod) % mod;
}

int main(){
    int n;
    cin >> n;
    ll x[n];
    ll y[n];
    ll kai = 1;
    for (int i = 1; i < n; i++)
        kai = kai * i % mod;
    rep(i, n) cin >> x[i];
    y[0] = 0;
    for(int i=1; i<n; i++) {
        y[i] = kai * modpow(i, mod - 2) % mod;
        y[i] = (y[i-1] + y[i]) % mod;
    }
    ll sum = 0;

    rep(i, n-1) {
        sum += y[i+1] * (x[i+1]-x[i]);
        sum %= mod;
    }

    cout << sum << endl;
    
    return 0;
}