#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);

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

int main(){
    int n;sc(n)
    vector<int> x(n);
    REP(i, n) sc(x[i])
    int mod = 1e9 + 7;
    ll ans = 0, seg, sum = 0;

    REP(i, n - 1){
        seg = (x[i + 1] - x[i] + mod) % mod;
        sum = (sum + modpow(i + 1, mod - 2, mod)) %mod;
        ans = (ans + seg * sum % mod) %mod;
    }

    ll acc = 1;
    for (int i = 1; i < n; i++){
        acc *= i;
        acc %= mod;
    }

    cout << (ans * acc)%mod << endl;
    return 0;
}